From 4180d2c621bc00d08e9ff8ccc03acc29d6be15d3 Mon Sep 17 00:00:00 2001 From: Sven Boemer Date: Wed, 5 Jun 2024 18:05:34 +0000 Subject: [PATCH] Check HasDebugHeader --- Mono.Cecil.Cil/PortablePdb.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Mono.Cecil.Cil/PortablePdb.cs b/Mono.Cecil.Cil/PortablePdb.cs index 0ffa1815d..3b61c6851 100644 --- a/Mono.Cecil.Cil/PortablePdb.cs +++ b/Mono.Cecil.Cil/PortablePdb.cs @@ -321,7 +321,10 @@ public void Write () string GetPdbPath () { - var debugHeader = module.Image.DebugHeader; + if (!module.HasDebugHeader) + return string.Empty; + + var debugHeader = module.GetDebugHeader (); foreach (var entry in debugHeader.Entries) { var data = entry.Data; // Pdb path is NUL-terminated path at offset 24.