summaryrefslogtreecommitdiff
path: root/python/binaryview.py
diff options
context:
space:
mode:
authorPeter LaFosse <peter@vector35.com>2021-09-05 12:32:20 -0400
committerPeter LaFosse <peter@vector35.com>2021-09-06 11:46:44 -0400
commitab7d668236aaf50b9521a9a9f0348976ddd3aa96 (patch)
treef65b350d0c5766a82596c67a8db2769a3517d6ff /python/binaryview.py
parent9fff4bb84db93a7b11a8537a1cc0293c542132d0 (diff)
Fix _platform_recognizers and type error in binaryview.py
Diffstat (limited to 'python/binaryview.py')
-rw-r--r--python/binaryview.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/python/binaryview.py b/python/binaryview.py
index 930eac18..4b78dc49 100644
--- a/python/binaryview.py
+++ b/python/binaryview.py
@@ -639,9 +639,9 @@ class _BinaryViewTypeMetaclass(type):
class BinaryViewType(metaclass=_BinaryViewTypeMetaclass):
+ _platform_recognizers = {}
def __init__(self, handle:core.BNBinaryViewTypeHandle):
# Used to force Python callback objects to not get garbage collected
- _platform_recognizers = {}
_handle = core.BNBinaryViewTypeHandle
self.handle = ctypes.cast(handle, _handle)
@@ -902,7 +902,9 @@ class BinaryViewType(metaclass=_BinaryViewTypeMetaclass):
meta_obj = binaryninja.metadata.Metadata(handle = core.BNNewMetadataReference(meta))
plat = cb(view_obj, meta_obj)
if plat:
- return ctypes.cast(core.BNNewPlatformReference(plat.handle), ctypes.c_void_p).value
+ handle = core.BNNewPlatformReference(plat.handle)
+ assert handle is not None, "core.BNNewPlatformReference returned None"
+ return ctypes.cast(handle, ctypes.c_void_p).value
except:
binaryninja.log_error(traceback.format_exc())
return None