From 8cf4503a00f6e0ccb93f5a9089cf660f20b0045b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20P=C3=B6hn?= Date: Wed, 15 May 2024 16:52:52 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9C=20scanner:=20fix=20ScannerTool=20i?= =?UTF-8?q?nit=20crash?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When scanner.py::ScannerTool is instatiated but the calling code was started by a call to e.g. `build.py` ScannerTool will crash. This change makes it so that ScannerTool will intializes with a default value instead of crashing when triging to access a non existen cli argument. also see https://gitlab.com/fdroid/fdroidserver/-/issues/1212 --- fdroidserver/scanner.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fdroidserver/scanner.py b/fdroidserver/scanner.py index fc9ef13a..bc6e579d 100644 --- a/fdroidserver/scanner.py +++ b/fdroidserver/scanner.py @@ -332,7 +332,7 @@ class ScannerTool: self.scanner_data_lookup() options = common.get_options() - options_refresh_scanner = options and options.refresh_scanner + options_refresh_scanner = hasattr(options, "refresh_scanner") and options.refresh_scanner if options_refresh_scanner or common.get_config().get('refresh_scanner'): self.refresh()