Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 891ad8c

Browse files
committed
code review fixes
1 parent 5ea9c3c commit 891ad8c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/runtime/exceptions.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,11 @@ internal static Exception ToException(IntPtr ob)
8989
static void ClearOffsetHelper(IntPtr ob, int offset)
9090
{
9191
var field = Marshal.ReadIntPtr(ob, offset);
92-
Runtime.XDecref(field);
93-
Marshal.WriteIntPtr(ob, offset, IntPtr.Zero);
92+
if (field != IntPtr.Zero)
93+
{
94+
Marshal.WriteIntPtr(ob, offset, IntPtr.Zero);
95+
Runtime.XDecref(field);
96+
}
9497
}
9598

9699
// As seen in exceptions.c, every derived type must also clean the base.

0 commit comments

Comments
 (0)