diff options
author | Manos Pitsidianakis <el13635@mail.ntua.gr> | 2019-04-04 00:30:30 +0300 |
---|---|---|
committer | Manos Pitsidianakis <el13635@mail.ntua.gr> | 2019-06-10 19:40:42 +0300 |
commit | 37f95dd86db67826eba48957f8e864c7fde14eb7 (patch) | |
tree | 9fd4ac75316a59883bdcb414760fc887d53f7b82 | |
parent | 43f89ef680fc5b75726cb77e8ee51074e485ca86 (diff) |
ui: fix crash when ThreadView is initiated without a ready mailbox
-rw-r--r-- | ui/src/components/mail/listing/compact.rs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/ui/src/components/mail/listing/compact.rs b/ui/src/components/mail/listing/compact.rs index 8ecbb956..17ab9e54 100644 --- a/ui/src/components/mail/listing/compact.rs +++ b/ui/src/components/mail/listing/compact.rs @@ -110,12 +110,7 @@ impl CompactListing { /// chosen. fn refresh_mailbox(&mut self, context: &mut Context) { self.dirty = true; - if self.cursor_pos == self.new_cursor_pos { - self.view.update(context); - } else { - self.view = ThreadView::new(self.cursor_pos, None, context); - } - + let old_cursor_pos = self.cursor_pos; if !(self.cursor_pos.0 == self.new_cursor_pos.0 && self.cursor_pos.1 == self.new_cursor_pos.1) { @@ -149,6 +144,12 @@ impl CompactListing { return; } } + if old_cursor_pos == self.new_cursor_pos { + self.view.update(context); + } else { + self.view = ThreadView::new(self.new_cursor_pos, None, context); + } + let mailbox = &context.accounts[self.cursor_pos.0][self.cursor_pos.1] .as_ref() .unwrap(); |