From 979515fb42365fbe6f000086ef13c125150f36c3 Mon Sep 17 00:00:00 2001 From: Brandon Miller Date: Mon, 16 Jun 2025 13:16:32 -0400 Subject: Don't yield None in BinaryView hlil|mlil_functions --- python/function.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'python/function.py') diff --git a/python/function.py b/python/function.py index cf8bafdd..126892ec 100644 --- a/python/function.py +++ b/python/function.py @@ -1549,13 +1549,21 @@ class Function: @property def llil_basic_blocks(self) -> Generator['lowlevelil.LowLevelILBasicBlock', None, None]: """A generator of all LowLevelILBasicBlock objects in the current function""" - for block in self.llil: + llil = self.llil + if llil is None: + return + + for block in llil: yield block @property def mlil_basic_blocks(self) -> Generator['mediumlevelil.MediumLevelILBasicBlock', None, None]: """A generator of all MediumLevelILBasicBlock objects in the current function""" - for block in self.mlil: + mlil = self.mlil + if mlil is None: + return + + for block in mlil: yield block @property @@ -1883,6 +1891,10 @@ class Function: >>> func.get_llils_at(func.start) [] """ + llil = self.llil + if llil is None: + return [] + if arch is None: arch = self.arch count = ctypes.c_ulonglong() @@ -1891,7 +1903,7 @@ class Function: try: result = [] for i in range(0, count.value): - result.append(self.llil[instrs[i]]) + result.append(llil[instrs[i]]) return result finally: core.BNFreeILInstructionList(instrs) -- cgit v1.3.1