diff options
Diffstat (limited to 'src/widget.rs')
-rw-r--r-- | src/widget.rs | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/widget.rs b/src/widget.rs index 6cb19eb..8e2019d 100644 --- a/src/widget.rs +++ b/src/widget.rs @@ -192,9 +192,16 @@ impl WidgetCore { } pub fn config(&self) -> Config { - self.config.read().unwrap().get() - .map(|config| config.clone()) - .unwrap_or(Config::new()) + self.get_conf() + .unwrap_or_else(|_| Config::new()) + } + + fn get_conf(&self) -> HResult<Config> { + let conf = self.config + .read()? + .get()? + .clone(); + Ok(conf) } } |