From 23d2d87c248ae1e77e7b008f51392794971d5907 Mon Sep 17 00:00:00 2001 From: "B. Petersen" Date: Thu, 3 Oct 2019 16:55:12 +0200 Subject: [PATCH] do not panic on missing or wrong formatted values in the database --- src/config.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/config.rs b/src/config.rs index a7ca2bed1..a9ee79fbb 100644 --- a/src/config.rs +++ b/src/config.rs @@ -99,7 +99,9 @@ impl Context { } pub fn get_config_int(&self, key: Config) -> i32 { - self.get_config(key).and_then(|s| s.parse().ok()).unwrap() + self.get_config(key) + .and_then(|s| s.parse().ok()) + .unwrap_or_default() } pub fn get_config_bool(&self, key: Config) -> bool {