From 35ed2c23d22b8eea385f4a25a56e10988482f1a6 Mon Sep 17 00:00:00 2001 From: pQu4k3r Date: Wed, 9 Sep 2026 17:42:35 +0000 Subject: [PATCH] Fix crash when selecting City with no offline city list Reported crash log: - city_panel.py: prepare_city_list() detected a missing new_city.cfg and opened a warning MessageBox, but then fell through into the open() call unconditionally anyway, raising FileNotFoundError (caught internally, but pointless). Missing `return` after showing the warning. - plugin.py: the MessageBox's callback (_close_panel) called self.close() with no arguments, and Foreca_Preview.city_selected required a positional `result` argument with no default, so the callback dispatch crashed with TypeError, producing the blue-screen error. Fixed both: _close_panel now closes with an explicit None (matching city_selected's existing `if result is None: return` handling), and city_selected got a `result=None` default so any other callback-with-no-args path can't hit the same crash. Note: new_city.cfg is only ever read, never written anywhere in the codebase - README's claim that the plugin creates it automatically during a search isn't actually implemented. Flagging this separately as a documentation/feature gap, not fixed here. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01UPpumFb2PP21ATpDwJBYBB --- .../enigma2/python/Plugins/Extensions/Foreca1/city_panel.py | 5 +++-- usr/lib/enigma2/python/Plugins/Extensions/Foreca1/plugin.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/usr/lib/enigma2/python/Plugins/Extensions/Foreca1/city_panel.py b/usr/lib/enigma2/python/Plugins/Extensions/Foreca1/city_panel.py index 7b7368d4..09b42eae 100644 --- a/usr/lib/enigma2/python/Plugins/Extensions/Foreca1/city_panel.py +++ b/usr/lib/enigma2/python/Plugins/Extensions/Foreca1/city_panel.py @@ -166,17 +166,18 @@ def prepare_city_list(self): self.city_list = [] def _close_panel(*args): - self.close() + self.close(None) city_cfg_path = join(SYSTEM_DIR, "new_city.cfg") if not exists(city_cfg_path): self.session.openWithCallback( _close_panel, MessageBox, - _("City list file not found!"), + _("City list file not found! Use the search to find your city first."), MessageBox.TYPE_WARNING, timeout=5 ) + return try: with open(city_cfg_path, "r", encoding="utf-8") as f: diff --git a/usr/lib/enigma2/python/Plugins/Extensions/Foreca1/plugin.py b/usr/lib/enigma2/python/Plugins/Extensions/Foreca1/plugin.py index 25ac6e69..9291ca9b 100644 --- a/usr/lib/enigma2/python/Plugins/Extensions/Foreca1/plugin.py +++ b/usr/lib/enigma2/python/Plugins/Extensions/Foreca1/plugin.py @@ -963,7 +963,7 @@ def menu_callback(self, choice): elif key == "exit": return - def city_selected(self, result): + def city_selected(self, result=None): if result is None: return