From ad05f7830392df4a7b9e3a3a2a9f34ca62c84079 Mon Sep 17 00:00:00 2001 From: Owen Dunn Date: Tue, 10 Jan 2006 20:02:22 +0000 Subject: [PATCH] Fix zero-rows-cols-crash [originally from svn r6515] --- terminal.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/terminal.c b/terminal.c index 2f7527cd..311df18c 100644 --- a/terminal.c +++ b/terminal.c @@ -1535,6 +1535,11 @@ void term_size(Terminal *term, int newrows, int newcols, int newsavelines) newsavelines == term->savelines) return; /* nothing to do */ + /* Behave sensibly if we're given zero (or negative) rows/cols */ + + if (newrows < 1) newrows = 1; + if (newcols < 1) newcols = 1; + deselect(term); swap_screen(term, 0, FALSE, FALSE);