diff --git a/src/module/debug/mod.rs b/src/module/debug/mod.rs index 6a7c83b5..0d7c2ad9 100644 --- a/src/module/debug/mod.rs +++ b/src/module/debug/mod.rs @@ -115,10 +115,12 @@ impl Emit for ModuleDebugData { sections .for_each( |id: SectionId, data: &write::EndianVec| -> Result<()> { - cx.wasm_module.section(&wasm_encoder::CustomSection { - name: id.name().into(), - data: data.slice().into(), - }); + if !data.slice().is_empty() { + cx.wasm_module.section(&wasm_encoder::CustomSection { + name: id.name().into(), + data: data.slice().into(), + }); + } Ok(()) }, )