From 83e996111e51aee4d65707605433378c19061ca0 Mon Sep 17 00:00:00 2001 From: Nutomic Date: Thu, 24 Mar 2022 16:23:12 +0000 Subject: [PATCH] Check that config is valid before saving (#2152) --- crates/utils/src/settings/mod.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crates/utils/src/settings/mod.rs b/crates/utils/src/settings/mod.rs index 92c9fb01f..bf1a8984d 100644 --- a/crates/utils/src/settings/mod.rs +++ b/crates/utils/src/settings/mod.rs @@ -88,6 +88,9 @@ impl Settings { } pub fn save_config_file(data: &str) -> Result { + // check that the config is valid + from_str::(data)?; + fs::write(Settings::get_config_location(), data)?; // Reload the new settings