From 15d986eb91b4ee976032f269ef51b2a74e30d626 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Tue, 20 Oct 2015 16:00:41 +0200 Subject: view: ensure minimal window size Do not create empty windows, more importantly do not overwrite random memory. Closes #80 --- view.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'view.c') diff --git a/view.c b/view.c index 6f48aaa..533061c 100644 --- a/view.c +++ b/view.c @@ -523,6 +523,10 @@ void view_draw(View *view) { } bool view_resize(View *view, int width, int height) { + if (width <= 0) + width = 1; + if (height <= 0) + height = 1; size_t lines_size = height*(sizeof(Line) + width*sizeof(Cell)); if (lines_size > view->lines_size) { Line *lines = realloc(view->lines, lines_size); -- cgit v1.2.3