From 28250c9f14a3b81894434dced33c5399752a05f7 Mon Sep 17 00:00:00 2001 From: Imbris Date: Thu, 12 Sep 2019 23:37:28 -0400 Subject: [PATCH] Fix always returning the default settings --- voxygen/src/settings.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/voxygen/src/settings.rs b/voxygen/src/settings.rs index 4a5f2ca0db..7e03831b18 100644 --- a/voxygen/src/settings.rs +++ b/voxygen/src/settings.rs @@ -236,7 +236,7 @@ impl Settings { if let Ok(file) = fs::File::open(&path) { match ron::de::from_reader(file) { - Ok(s) => s, + Ok(s) => return s, Err(e) => { log::warn!("Failed to parse setting file! Fallback to default. {}", e); // Rename the corrupted settings file @@ -249,6 +249,9 @@ impl Settings { } } } + // This is reached if either: + // - The file can't be opened (presumably it doesn't exist) + // - Or there was an error parsing the file let default_settings = Self::default(); default_settings.save_to_file_warn(); default_settings