From 6affb340f490909f6a57fe8cb81aee244db14836 Mon Sep 17 00:00:00 2001 From: Philipp Spitzer Date: Sun, 22 May 2022 16:16:01 +0200 Subject: [PATCH] Only offer to add map if it exists. --- bots/sledrun_wikitext_to_json.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bots/sledrun_wikitext_to_json.py b/bots/sledrun_wikitext_to_json.py index 196c0ce..b41840c 100644 --- a/bots/sledrun_wikitext_to_json.py +++ b/bots/sledrun_wikitext_to_json.py @@ -446,9 +446,10 @@ class SledrunWikiTextToJsonBot( pywikibot.output('\03{lightpurple}---\03{default}') self.userPut(sledrun_json_page, sledrun_json_page.text, sledrun_json_text, summary=summary, contentmodel='json') - map_json_text = json.dumps(map_json, ensure_ascii=False, indent=4) - summary = 'Landkarte konvertiert von Wikitext nach JSON.' - self.userPut(map_json_page, map_json_page.text, map_json_text, summary=summary, contentmodel='json') + if map_json is not None: + map_json_text = json.dumps(map_json, ensure_ascii=False, indent=4) + summary = 'Landkarte konvertiert von Wikitext nach JSON.' + self.userPut(map_json_page, map_json_page.text, map_json_text, summary=summary, contentmodel='json') def main(*args: str) -> None: -- 2.39.5