catch error behavior of bincode deserializer

This commit is contained in:
Simon Gardling 2022-05-16 10:04:15 -04:00
parent 6e2ed0f587
commit 4bb7fea2de

View File

@ -190,7 +190,7 @@ impl MathApp {
if commit == build::SHORT_COMMIT { if commit == build::SHORT_COMMIT {
tracing::info!("Reading previous function data"); tracing::info!("Reading previous function data");
let function_manager: FunctionManager = unsafe { bincode::deserialize(&func_data).unwrap_unchecked() }; let function_manager: FunctionManager = bincode::deserialize(&func_data).ok()?;
return Some(function_manager); return Some(function_manager);
} else { } else {
tracing::info!("Previous functions are invalid due to differing commits (build: {}, previous: {})", build::SHORT_COMMIT, commit); tracing::info!("Previous functions are invalid due to differing commits (build: {}, previous: {})", build::SHORT_COMMIT, commit);