listing: prevent invalid area in print_account()

jmap-eventsource
Manos Pitsidianakis 2020-11-26 06:32:41 +02:00
parent 883b3e3a4f
commit b053aaa145
Signed by: Manos Pitsidianakis
GPG Key ID: 73627C2F690DF710
1 changed files with 4 additions and 3 deletions

View File

@ -1468,6 +1468,9 @@ impl Listing {
self.dirty = false; self.dirty = false;
let mut y = get_y(upper_left); let mut y = get_y(upper_left);
for a in &self.accounts { for a in &self.accounts {
if y > get_y(bottom_right) {
break;
}
y += self.print_account(grid, (set_y(upper_left, y), bottom_right), &a, context); y += self.print_account(grid, (set_y(upper_left, y), bottom_right), &a, context);
y += 3; y += 3;
} }
@ -1484,9 +1487,7 @@ impl Listing {
a: &AccountMenuEntry, a: &AccountMenuEntry,
context: &mut Context, context: &mut Context,
) -> usize { ) -> usize {
if !is_valid_area!(area) { debug_assert!(is_valid_area!(area));
debug!("BUG: invalid area in print_account");
}
// Each entry and its index in the account // Each entry and its index in the account
let mailboxes: HashMap<MailboxHash, Mailbox> = context.accounts[a.index] let mailboxes: HashMap<MailboxHash, Mailbox> = context.accounts[a.index]
.mailbox_entries .mailbox_entries