story: Fix story panic when save state failed. (#1384)
Close #1383 --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: huacnlee <5518+huacnlee@users.noreply.github.com>
This commit is contained in:
parent
1bc5ff03df
commit
4fef96e407
1 changed files with 4 additions and 2 deletions
|
|
@ -49,8 +49,10 @@ pub fn init(cx: &mut App) {
|
||||||
scrollbar_show: Some(cx.theme().scrollbar_show),
|
scrollbar_show: Some(cx.theme().scrollbar_show),
|
||||||
};
|
};
|
||||||
|
|
||||||
let json = serde_json::to_string_pretty(&state).unwrap();
|
if let Ok(json) = serde_json::to_string_pretty(&state) {
|
||||||
std::fs::write(STATE_FILE, json).unwrap();
|
// Ignore write errors - if STATE_FILE doesn't exist or can't be written, do nothing
|
||||||
|
let _ = std::fs::write(STATE_FILE, json);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.detach();
|
.detach();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue