diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d408a8d1..380c6f6d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ This document follows the conventions laid out in [Keep a CHANGELOG][]. - Fixed conversion of 'float' and 'double' values (#486) - Fixed 'clrmethod' for python 2 (#492) - Fixed double calling of constructor when deriving from .NET class (#495) +- Fixed `clr.GetClrType` when iterating over `System` members (#607) ## [2.3.0][] - 2017-03-11 diff --git a/src/runtime/managedtype.cs b/src/runtime/managedtype.cs index 562b2e5f8..3191da949 100644 --- a/src/runtime/managedtype.cs +++ b/src/runtime/managedtype.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Runtime.InteropServices; namespace Python.Runtime @@ -34,6 +34,10 @@ internal static ManagedType GetManagedObject(IntPtr ob) IntPtr op = tp == ob ? Marshal.ReadIntPtr(tp, TypeOffset.magic()) : Marshal.ReadIntPtr(ob, ObjectOffset.magic(ob)); + if (op == IntPtr.Zero) + { + return null; + } var gc = (GCHandle)op; return (ManagedType)gc.Target; }