From aaa603fae7d3d19f725818b0636d4e5830f04853 Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Tue, 18 Apr 2023 08:44:50 +0200 Subject: [PATCH] =?UTF-8?q?autoconfig:=20get=5Ffirefox=5Fversion:=20add=20?= =?UTF-8?q?try=E2=80=A6catch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On first run / after: $ rm ~/.mozilla The function fails with: TypeError: Services.appinfo.lastAppVersion is null Expect the failure so the script doesn't crash. Revert "autoconfig: get_firefox_version: remove try…catch", but with another error message. Without this patch an error shows up when starting Firefox with the config, until the user manually starts it again. This reverts commit 2405aabd4c6afe6c0e3c0d4fb8c6ee52f615a3c5. --- src/mobile-config-autoconfig.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/mobile-config-autoconfig.js b/src/mobile-config-autoconfig.js index 6f1f4e3..68a6bb7 100644 --- a/src/mobile-config-autoconfig.js +++ b/src/mobile-config-autoconfig.js @@ -71,7 +71,12 @@ function log_obj(obj) { } function get_firefox_version() { - return Services.appinfo.lastAppVersion.split(".")[0]; + try { + return Services.appinfo.lastAppVersion.split(".")[0]; + } catch(e) { + log("Couldn't get Firefox version (expected on first start): " + e); + return 0; + } } function get_firefox_version_previous() {