Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix for "handle is not inialized" crash on `clr.GetClrType(System.__c…
…lass__)`
  • Loading branch information
den-run-ai committed Jan 28, 2018
commit 16f05e51d894f230787af0e7f64ac29514ab46fd
6 changes: 5 additions & 1 deletion src/runtime/managedtype.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Runtime.InteropServices;

namespace Python.Runtime
Expand Down Expand Up @@ -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;
}
Expand Down