summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRusty Wagner <rusty@vector35.com>2020-10-16 21:50:58 -0400
committerRusty Wagner <rusty@vector35.com>2020-10-16 21:51:34 -0400
commitcbebe461efab02c736c79bf48641f33c793a27f4 (patch)
treeeda74b6755d2f25e0b6b766e47ab1ac12042d683
parentba72c577874c83567737d08ca64d3e52090763b7 (diff)
Fix Python exception on HLIL instructions that do not have an associated basic block
-rw-r--r--python/highlevelil.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/python/highlevelil.py b/python/highlevelil.py
index d85905b1..e1d26f62 100644
--- a/python/highlevelil.py
+++ b/python/highlevelil.py
@@ -543,8 +543,14 @@ class HighLevelILInstruction(object):
@property
def il_basic_block(self):
- """IL basic block object containing this expression (read-only) (only available on finalized functions)"""
- return HighLevelILBasicBlock(self._function.source_function.view, core.BNGetHighLevelILBasicBlockForInstruction(self._function.handle, self._instr_index), self._function)
+ """
+ IL basic block object containing this expression (read-only) (only available on finalized functions).
+ Returns None for HLIL_BLOCK expressions as these can contain multiple basic blocks.
+ """
+ block = core.BNGetHighLevelILBasicBlockForInstruction(self._function.handle, self._instr_index)
+ if not block:
+ return None
+ return HighLevelILBasicBlock(self._function.source_function.view, block, self._function)
@property
def value(self):