From 458f8da33224f4a6670c7d60086e11daa6034974 Mon Sep 17 00:00:00 2001 From: Manos Pitsidianakis Date: Tue, 19 Nov 2019 20:40:28 +0200 Subject: [PATCH] ui: fix bounds check in StatusBar --- ui/src/components/utilities.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ui/src/components/utilities.rs b/ui/src/components/utilities.rs index 7a573f48..ddf1d156 100644 --- a/ui/src/components/utilities.rs +++ b/ui/src/components/utilities.rs @@ -687,8 +687,15 @@ impl StatusBar { None, ); let offset = self.status.find('|').unwrap_or_else(|| self.status.len()); - for x in get_x(upper_left!(area))..get_x(upper_left!(area)) + offset { - grid[(x, y)].set_attrs(Attr::Bold); + if y < get_y(bottom_right!(area)) + 1 { + for x in get_x(upper_left!(area)) + ..std::cmp::min( + get_x(upper_left!(area)) + offset, + get_x(bottom_right!(area)), + ) + { + grid[(x, y)].set_attrs(Attr::Bold); + } } if self.cur_notification.is_some() { let (t, n) = self.cur_notification.as_ref().unwrap();