From 108d7c228d055522ba9fe0f09d1dadd4035bb1d5 Mon Sep 17 00:00:00 2001 From: Jennifer Taylor Date: Tue, 4 May 2021 02:29:53 +0000 Subject: [PATCH] Handle having bytecode with no actual entries. --- bemani/format/afp/decompile.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bemani/format/afp/decompile.py b/bemani/format/afp/decompile.py index 110bf91..e833b29 100644 --- a/bemani/format/afp/decompile.py +++ b/bemani/format/afp/decompile.py @@ -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()