From 7c8eb3b108d8e3adae6e18e2b8026fc0f6990473 Mon Sep 17 00:00:00 2001 From: David Herrmann Date: Sun, 5 Feb 2012 15:44:20 +0100 Subject: [PATCH] console: fix bug in buffer-erase helper We didn't check for NULL line so we got segfaults when erasing empty lines. Fix this. Signed-off-by: David Herrmann --- src/console_cell.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/console_cell.c b/src/console_cell.c index 37758ec..1c8b943 100644 --- a/src/console_cell.c +++ b/src/console_cell.c @@ -918,6 +918,11 @@ void kmscon_buffer_erase_region(struct kmscon_buffer *buf, unsigned int x_from, for ( ; y_from <= y_to; ++y_from) { line = get_line(buf, y_from); + if (!line) { + x_from = 0; + continue; + } + if (y_from == y_to) to = x_to; else