From 3d62c2b8f54a87353f8182b64ce29d4558083075 Mon Sep 17 00:00:00 2001 From: Joe Wilm Date: Mon, 6 Jun 2016 17:46:26 -0700 Subject: Add explicit bounds check when advancing cursor --- src/term.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/term.rs b/src/term.rs index b25502f1..c254f6b9 100644 --- a/src/term.rs +++ b/src/term.rs @@ -158,6 +158,10 @@ impl Term { self.cursor.x = 0; } + if self.cursor.y == self.grid.num_rows() as u16 { + panic!("cursor fell off grid"); + } + let cell = &mut self.grid[self.cursor]; cell.c = c; cell.fg = self.fg; -- cgit