Fix crash when closed/reopened with no open file
This commit is contained in:
parent
9775aa6c51
commit
188b61d3a2
@ -67,6 +67,7 @@ pub fn run() {
|
|||||||
let store = app.store("store.json")?;
|
let store = app.store("store.json")?;
|
||||||
let db_filename = match store.get("db_filename") {
|
let db_filename = match store.get("db_filename") {
|
||||||
None => None,
|
None => None,
|
||||||
|
Some(serde_json::Value::Null) => None,
|
||||||
Some(serde_json::Value::String(s)) => {
|
Some(serde_json::Value::String(s)) => {
|
||||||
if fs::exists(&s)? {
|
if fs::exists(&s)? {
|
||||||
Some(s)
|
Some(s)
|
||||||
@ -74,7 +75,7 @@ pub fn run() {
|
|||||||
None
|
None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => panic!("Unexpected db_filename in store"),
|
_ => panic!("Unexpected db_filename in store: {:?}", store.get("db_filename")),
|
||||||
};
|
};
|
||||||
|
|
||||||
app.manage(Mutex::new(AppState {
|
app.manage(Mutex::new(AppState {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user