From 636a18cee9972f033d59ad373cf02fcc70b88d71 Mon Sep 17 00:00:00 2001 From: Bonta-kun <40473493+Bonta0@users.noreply.github.com> Date: Tue, 31 Dec 2019 15:47:49 +0100 Subject: [PATCH] Rom: sanitize hint_text input --- Rom.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Rom.py b/Rom.py index f6b9e0e4..aa4c150a 100644 --- a/Rom.py +++ b/Rom.py @@ -1337,13 +1337,18 @@ def write_strings(rom, world, player): tt['kakariko_flophouse_man'] = 'I really hate mowing my yard.\n{PAGEBREAK}\nI should move.' def hint_text(dest, ped_hint=False): - hint = dest.hint_text if not ped_hint else dest.pedestal_hint_text + if not dest: + return "nothing" + if ped_hint: + hint = dest.pedestal_hint_text if dest.pedestal_hint_text else "unknown item" + else: + hint = dest.hint_text if dest.hint_text else "something" if dest.player != player: if ped_hint: hint += " for p%d!" % dest.player elif type(dest) in [Region, Location]: hint += " in p%d's world" % dest.player - elif type(dest) is Item: + else: hint += " for p%d" % dest.player return hint