From fedf951dfd90c976893e4fca613a201ecea2819f Mon Sep 17 00:00:00 2001 From: Pavel Volokitin Date: Wed, 28 Sep 2022 01:08:58 +0200 Subject: [PATCH] vt100: Check more bounds --- vendor/vt100/src/row.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/vendor/vt100/src/row.rs b/vendor/vt100/src/row.rs index b69a832..91a631f 100644 --- a/vendor/vt100/src/row.rs +++ b/vendor/vt100/src/row.rs @@ -87,13 +87,15 @@ impl Row { pub fn clear_wide(&mut self, col: u16) { let cell = &self.cells[usize::from(col)]; let other = if cell.is_wide() { - &mut self.cells[usize::from(col + 1)] + self.cells.get_mut(usize::from(col + 1)) } else if cell.is_wide_continuation() { - &mut self.cells[usize::from(col - 1)] + self.cells.get_mut(usize::from(col - 1)) } else { return; }; - other.clear(*other.attrs()); + if let Some(other) = other { + other.clear(*other.attrs()); + } } pub fn write_contents(