Skip to content

Commit 04c482c

Browse files
committed
Add missing 'IsNil' check
1 parent 8be0967 commit 04c482c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/coreclr/tools/Common/Internal/Metadata/NativeFormat/NativeMetadataReader.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,11 @@ internal bool StringEquals(ConstantStringValueHandle handle, string value)
223223

224224
internal ReadOnlySpan<byte> ReadStringAsBytes(ConstantStringValueHandle handle)
225225
{
226+
if (handle.IsNil)
227+
{
228+
return ReadOnlySpan<byte>.Empty;
229+
}
230+
226231
return _streamReader.ReadStringAsBytes((uint)handle.Offset);
227232
}
228233
}

0 commit comments

Comments
 (0)