From 1085127036b23591571c572f9d113f49c0d73feb Mon Sep 17 00:00:00 2001 From: Julian Ganz Date: Mon, 25 Jan 2016 20:38:45 +0100 Subject: [PATCH] Add missing error handling We don't want to panick if a lock inside the store is broken. We want to notify the user, so she can start panicking. --- libimagstore/src/store.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libimagstore/src/store.rs b/libimagstore/src/store.rs index 3ff1b26b..e8fbbb98 100644 --- a/libimagstore/src/store.rs +++ b/libimagstore/src/store.rs @@ -193,6 +193,10 @@ impl Store { /// Delete an entry pub fn delete(&self, id: StoreId) -> Result<()> { let mut entries_lock = self.entries.write(); + if entries_lock.is_err() { + return Err(StoreError::new(StoreErrorKind::LockPoisoned, None)) + } + let mut entries = entries_lock.unwrap(); // if the entry is currently modified by the user, we cannot drop it