ui: fix crash when ThreadView is initiated without a ready mailbox

embed
Manos Pitsidianakis 2019-04-04 00:30:30 +03:00
parent 43f89ef680
commit 37f95dd86d
Signed by: Manos Pitsidianakis
GPG Key ID: 73627C2F690DF710
1 changed files with 7 additions and 6 deletions

View File

@ -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();