mirror of
https://github.com/FranP-code/ChatGPT.git
synced 2025-10-13 00:13:25 +00:00
fix: conf error (#295)
This commit is contained in:
@@ -76,7 +76,14 @@ impl AppConf {
|
||||
|
||||
pub fn read() -> Self {
|
||||
match std::fs::read_to_string(Self::file_path()) {
|
||||
Ok(v) => serde_json::from_str::<AppConf>(&v).unwrap(),
|
||||
Ok(v) => {
|
||||
if let Ok(v2) = serde_json::from_str::<AppConf>(&v) {
|
||||
v2
|
||||
} else {
|
||||
error!("conf_read_parse_error");
|
||||
Self::default()
|
||||
}
|
||||
}
|
||||
Err(err) => {
|
||||
error!("conf_read_error: {}", err);
|
||||
Self::default()
|
||||
|
||||
Reference in New Issue
Block a user