summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2019-12-24 12:27:21 +0100
committerMatthias Beyer <mail@beyermatthias.de>2019-12-24 13:49:16 +0100
commit0cac7ec15774f8381e2c260e37754e17788875f2 (patch)
tree33ed08fd20ba3938acfb42f6e36e75fcf0ae1a69
parent9f1a1f7a319d0dc1333f9d23112161a8c12a9f19 (diff)
Fix: Drop habit before getting instances
Because when showing an instance, we try to get the comment for the instance from the habit template, which tries to Store::get() the template in HabitInstance::get_comment(). This fails if the template is already borrowed, thus drop the borrow before the whole thing. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
-rw-r--r--bin/domain/imag-habit/src/lib.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/bin/domain/imag-habit/src/lib.rs b/bin/domain/imag-habit/src/lib.rs
index 96d88f01..4350b20e 100644
--- a/bin/domain/imag-habit/src/lib.rs
+++ b/bin/domain/imag-habit/src/lib.rs
@@ -514,7 +514,9 @@ fn show(rt: &Runtime) -> Result<()> {
let mut j = 0;
let mut empty = true;
- habit.linked_instances()?
+ let instances = habit.linked_instances()?;
+ drop(habit);
+ instances
.into_get_iter(rt.store())
.map_inner_ok_or_else(|| err_msg("Did not find one habit template"))
.and_then_ok(|e| {