Skip to content

Commit

Permalink
wmllint: fix a crash if advances_to= is placed before id= in [unit_type]
Browse files Browse the repository at this point in the history
This was supposed to be a part of the fix for #4102, but for some reason it never got committed.
  • Loading branch information
Elvish-Hunter committed Dec 3, 2020
1 parent 4ada05a commit 5e4ba6c
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions data/tools/wmllint
Expand Up @@ -1587,26 +1587,22 @@ def global_sanity_check(filename, lines):
elif key == "hitpoints":
hitpoints_specified = True
elif key == "usage":
assert(unit_id)
usage[unit_id] = value
unit_usage = value
elif key == "movement_type":
if '{' not in value:
assert(unit_id)
unit_movetypes.append((unit_id, filename, nav.lineno + 1, value))
temp_movetypes.append((filename, nav.lineno + 1, value))
if value == "undeadspirit":
spirit_note_needed = True
elif value == "mounted":
defense_cap_note_needed = True
elif key == "race":
if '{' not in value:
assert(unit_id or base_unit)
unit_race = value
unit_races.append((unit_id, filename, nav.lineno + 1, unit_race))
temp_races.append((filename, nav.lineno + 1, unit_race))
elif key == "advances_to":
assert(unit_id or base_unit)
advancements = value
if advancements.strip() != "null":
advances.append((unit_id, filename, nav.lineno + 1, advancements))
temp_advances.append((filename, nav.lineno + 1, advancements))
elif key == "type" and value == "arcane" and "[attack]" in nav.ancestors():
arcane_note_needed = True
elif "[defense]" in nav.ancestors() and re.match(r"\-\d+",value):
Expand Down

0 comments on commit 5e4ba6c

Please sign in to comment.