From 7635525fa3148a7b9f06e75ad1b197d3cc102de8 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 c17e7c29..073da1e6 100644 --- a/fdroidserver/scanner.py +++ b/fdroidserver/scanner.py @@ -331,7 +331,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()