From 6db079c21099737d92df2f743f5c94e4592492a5 Mon Sep 17 00:00:00 2001 From: KyleMiles Date: Thu, 19 Sep 2019 18:11:44 +0000 Subject: Fix call to BNDefineAutoSymbolAndVariableOrFunction --- python/binaryview.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'python/binaryview.py') diff --git a/python/binaryview.py b/python/binaryview.py index a48880dd..aef72a6a 100644 --- a/python/binaryview.py +++ b/python/binaryview.py @@ -3287,7 +3287,7 @@ class BinaryView(object): .. warning:: If multiple symbols for the same address are defined, only the most recent symbol will ever be used. :param Symbol sym: the symbol to define - :param SymbolType sym_type: Type of symbol being defined + :param SymbolType sym_type: Type of symbol being defined (can be None) :param Platform plat: (optional) platform :rtype: None """ @@ -3295,7 +3295,13 @@ class BinaryView(object): plat = self.platform elif not isinstance(plat, binaryninja.platform.Platform): raise AttributeError("Provided platform is not of type `binaryninja.platform.Platform`") - core.BNDefineAutoSymbolAndVariableOrFunction(self.handle, plat.handle, sym.handle, sym_type.handle) + + if isinstance(sym_type, binaryninja.SymbolType): + sym_type = sym_type.handle + elif sym_type is not None: + raise AttributeError("Provided sym_type is not of type `binaryninja.SymbolType`") + + core.BNDefineAutoSymbolAndVariableOrFunction(self.handle, plat.handle, sym.handle, sym_type) def undefine_auto_symbol(self, sym): """ -- cgit v1.3.1