| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent eb27f97 commit 69cd539
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -294,9 +294,18 @@ internal Binding Bind(IntPtr inst, IntPtr args, IntPtr kw, | |||
| 294 | 294 | ||
| 295 | 295 | Object target = null; | |
| 296 | 296 | if ((!mi.IsStatic) && (inst != IntPtr.Zero)) { | |
| 297 | - CLRObject co = (CLRObject)ManagedType.GetManagedObject( | ||
| 298 | - inst | ||
| 299 | - ); | ||
| 297 | + //CLRObject co = (CLRObject)ManagedType.GetManagedObject(inst); | ||
| 298 | + // InvalidCastException: Unable to cast object of type | ||
| 299 | + // 'Python.Runtime.ClassObject' to type 'Python.Runtime.CLRObject' | ||
| 300 | + CLRObject co = ManagedType.GetManagedObject(inst) as CLRObject; | ||
| 301 | + | ||
| 302 | + // Sanity check: this ensures a graceful exit if someone does | ||
| 303 | + // something intentionally wrong like call a non-static method | ||
| 304 | + // on the class rather than on an instance of the class. | ||
| 305 | + // XXX maybe better to do this before all the other rigmarole. | ||
| 306 | + if (co == null) { | ||
| 307 | + return null; | ||
| 308 | + } | ||
| 300 | 309 | target = co.inst; | |
| 301 | 310 | } | |
| 302 | 311 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments