1
0
mirror of synced 2025-01-31 12:13:49 +01:00

Handle having bytecode with no actual entries.

This commit is contained in:
Jennifer Taylor 2021-05-04 02:29:53 +00:00
parent 54b4c88d65
commit 108d7c228d

View File

@ -26,7 +26,7 @@ class ByteCode:
# A list of bytecodes to execute.
def __init__(self, actions: Sequence[AP2Action], end_offset: int) -> None:
self.actions = list(actions)
self.start_offset = self.actions[0].offset
self.start_offset = self.actions[0].offset if actions else None
self.end_offset = end_offset
def as_dict(self, *args: Any, **kwargs: Any) -> Dict[str, Any]:
@ -3248,4 +3248,8 @@ class ByteCodeDecompiler(VerboseOutput):
def decompile(self, verbose: bool = False) -> None:
with self.debugging(verbose):
self.__decompile()
if self.bytecode.start_offset is None:
self.vprint("ByteCode is empty, decompiling to nothing!")
self.__statements = []
else:
self.__decompile()