mirror of
https://github.com/Xeeynamo/sotn-decomp.git
synced 2025-02-19 20:50:46 +00:00
Fix zero-related bug in decompile.py (#1194)
When using the `dec` script, it is possible to select a function where there are multiple functions sharing a name. The test case I had for this was `EntityEquipItemDrop`. If you run `dec EntityEquipItemDrop`, it will tell you that there are 4 occurrences of functions with that name, and list the four, telling you to re-run with -n or -f to specify which. If you choose to specify option #0, with `dec EntityEquipItemDrop -n 0`, then the number_occurence variable will be set to zero. But the if-statement `if number_occurrence` fails, because the value is zero, which is parsed as False. Decompilation therefore fails, as if you had not passed `-n`. This change explicitly tests for None, so that zero is a valid selection.
This commit is contained in:
parent
02d5d97d81
commit
4d4c039ac4
@ -272,7 +272,7 @@ def decompile(func_name: str, number_occurrence: int = None, force: bool = False
|
||||
|
||||
if force:
|
||||
funcs = funcs[:1]
|
||||
elif number_occurrence and number_occurrence < len(funcs):
|
||||
elif number_occurrence is not None and number_occurrence < len(funcs):
|
||||
funcs = [funcs[number_occurrence]]
|
||||
else:
|
||||
if len(funcs) > 1:
|
||||
|
Loading…
x
Reference in New Issue
Block a user