Skip to content

Commit

Permalink
partial fix for missing attrs in rawif CensoredUsername#197
Browse files Browse the repository at this point in the history
  • Loading branch information
madeddy committed Mar 6, 2024
1 parent ecd378f commit 0999b7e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions decompiler/atldecompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ def print_block(self, block):
# Prints a block of ATL statements
# block is a renpy.atl.RawBlock instance.
with self.increase_indent():
if block.statements:
if hasattr(block, "statements") and block.statements:
self.print_nodes(block.statements)

# If a statement ends with a colon but has no block after it, loc will
# get set to ('', 0). That isn't supposed to be valid syntax, but it's
# the only thing that can generate that, so we do not write "pass" then.
elif block.loc != ('', 0):
elif hasattr(block, "loc") and block.loc != ('', 0):

# if there were no contents insert a pass node to keep syntax valid.
self.indent()
Expand All @@ -58,6 +58,9 @@ def advance_to_block(self, block):
# note: the location property of a RawBlock points to the first line of the block,
# not the statement that created it.
# it can also contain the following nonsense if there was no block for some reason.

# TODO: see L45 L51: hasattr should also be needed to be added here? -> like this:
# if hasattr(block, "loc") and block.loc != ('', 0):
if block.loc != ('', 0):
self.advance_to_line(block.loc[1] - 1)

Expand Down

0 comments on commit 0999b7e

Please sign in to comment.