From 03c6ac008cf9503e2037ab4e31f6cf2dd6279775 Mon Sep 17 00:00:00 2001 From: decentral1se Date: Thu, 18 Mar 2021 10:18:00 +0100 Subject: [PATCH] Avoid exploding when magic_words are not counted See https://git.vvvvvvaria.org/varia/etherpump/issues/18. --- etherpump/commands/pull.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/etherpump/commands/pull.py b/etherpump/commands/pull.py index 73221c2..01ae9bc 100644 --- a/etherpump/commands/pull.py +++ b/etherpump/commands/pull.py @@ -529,11 +529,10 @@ async def handle_pad(args, padid, data, info, session): async with await trio.open_file(metapath, "w") as f: await f.write(json.dumps(meta)) - mwords_msg = ( - ", magic words: {}".format(", ".join(magic_words)) - if magic_words - else "" - ) + try: + mwords_msg = ", magic words: {}".format(", ".join(magic_words)) + except UnboundLocalError: + mwords_msg = "" # Note(decentral1se): for when magic_words are not counted print("[x] {} (saved{})".format(padid, mwords_msg)) saved += 1