Show error message if active savefile is not loadable
This commit is contained in:
parent
1dadc433b1
commit
733b76d47f
@ -77,12 +77,22 @@ impl State {
|
|||||||
create_dir_all(&data_dir)?;
|
create_dir_all(&data_dir)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
let savefile = load_last_active_savefile()?;
|
let state = match load_last_active_savefile() {
|
||||||
|
Ok(savefile) => Self {
|
||||||
|
savefile,
|
||||||
|
..Default::default()
|
||||||
|
},
|
||||||
|
Err(err) => {
|
||||||
|
let mut state = Self {
|
||||||
|
savefile: None,
|
||||||
|
..Default::default()
|
||||||
|
};
|
||||||
|
state.show_error_message(err);
|
||||||
|
state
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
Ok(Self {
|
Ok(state)
|
||||||
savefile,
|
|
||||||
..Default::default()
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn show_error_message<S>(&mut self, msg: S)
|
pub fn show_error_message<S>(&mut self, msg: S)
|
||||||
|
Loading…
Reference in New Issue
Block a user