From 92be6a998ebf6033faab166c5d3bf5067b96444c Mon Sep 17 00:00:00 2001 From: Madis Liias Date: Tue, 25 Apr 2023 21:42:07 +0300 Subject: [PATCH] Don't crash if Firefox is installed, but profiles.ini can't be found When user has installed Firefox, but never ran it, then the profiles.ini does not yet exist. --- src/firefox_profiles_parser.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/firefox_profiles_parser.rs b/src/firefox_profiles_parser.rs index d41e71c..54d3385 100644 --- a/src/firefox_profiles_parser.rs +++ b/src/firefox_profiles_parser.rs @@ -23,7 +23,20 @@ pub fn find_firefox_profiles( let mut browser_profiles: Vec = Vec::new(); let profiles_ini_path = firefox_profiles_dir.join("profiles.ini"); - debug!("profiles_ini_path: {:?}", profiles_ini_path); + debug!( + "profiles_ini_path: {:?}", + profiles_ini_path + ); + + // When user has installed Firefox, but never ran it, then the profiles.ini does not yet exist + if !profiles_ini_path.exists() { + info!( + "Skipping Firefox, because profiles.ini does not exist at '{}'", + profiles_ini_path.display() + ); + + return browser_profiles; + } let mut ini_default = IniDefault::default(); ini_default.case_sensitive = true;