From 4bb7fea2de9518fb934bb77996cd9e5bdbbb979e Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Mon, 16 May 2022 10:04:15 -0400 Subject: [PATCH] catch error behavior of bincode deserializer --- src/math_app.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/math_app.rs b/src/math_app.rs index 5bd2b0a..6af22d6 100644 --- a/src/math_app.rs +++ b/src/math_app.rs @@ -190,7 +190,7 @@ impl MathApp { if commit == build::SHORT_COMMIT { 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); } else { tracing::info!("Previous functions are invalid due to differing commits (build: {}, previous: {})", build::SHORT_COMMIT, commit);