diff --git a/src-tauri/src/frontend_calls/config.rs b/src-tauri/src/frontend_calls/config.rs index e1aec5a..43bd0db 100644 --- a/src-tauri/src/frontend_calls/config.rs +++ b/src-tauri/src/frontend_calls/config.rs @@ -1,6 +1,6 @@ use std::{fs, path::PathBuf, sync::Mutex}; -use serde_json::Value; +use serde_json::{Map, Value}; use tauri::State; pub fn get_config_path() -> PathBuf { @@ -25,7 +25,9 @@ pub struct Config{ impl Config{ pub fn new() -> Config{ let path = get_config_path(); - let config: Value = serde_json::from_str(&fs::read_to_string(&path).unwrap()).unwrap(); + let config: Value = serde_json::from_str(&fs::read_to_string(&path) + .unwrap_or("{}".to_owned())) + .unwrap_or(Value::Object(Map::new())); Config { config: Mutex::new(config)