Skip to content

Commit

Permalink
skip Nones
Browse files Browse the repository at this point in the history
  • Loading branch information
Felienne committed Jan 25, 2024
1 parent 51790a6 commit e6bd89d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions hedy_translation.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,10 +376,11 @@ def pressed(self, tree):
def add_rule(self, token_name, token_keyword, tree):
if token_name[:4] == "text": # this is not superduper pretty but for now it works!
token = self.get_keyword_token('text', tree)
rule = Rule(
token_name, token.line, token.column - 1, token.end_column, token.value
)
self.rules.append(rule)
if token:
rule = Rule(
token_name, token.line, token.column - 1, token.end_column, token.value
)
self.rules.append(rule)
else:
token = self.get_keyword_token(token_name, tree)
if token:
Expand Down

0 comments on commit e6bd89d

Please sign in to comment.