wmllint: fix a crash if advances_to= is placed before id= in [unit_type]

This was supposed to be a part of the fix for #4102, but for some reason it never got committed.
This commit is contained in:
Elvish_Hunter 2020-12-03 20:55:12 +01:00
parent 4ada05a2cf
commit 5e4ba6c01b

View file

@ -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):