chat: guard pop_line against empty list

Small defensive improvement - only pop markers and invalidate scroll
if lines.pop() actually removed something.

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
Kent Overstreet 2026-04-12 16:04:43 -04:00
parent f06c8077e1
commit 195abfaab1

View file

@ -368,9 +368,10 @@ impl PaneState {
} }
fn pop_line(&mut self) { fn pop_line(&mut self) {
self.lines.pop(); if self.lines.pop().is_some() {
self.markers.pop(); self.markers.pop();
self.scroll.invalidate_from(self.lines.len()); self.scroll.invalidate_from(self.lines.len());
}
} }
fn scroll_up(&mut self, n: u16) { fn scroll_up(&mut self, n: u16) {