From a275f2aaaf690ba00e57d5be940ace2162c13a6d Mon Sep 17 00:00:00 2001 From: "Michael D. Lowis" Date: Thu, 2 Feb 2017 12:38:48 -0500 Subject: [PATCH] fixed view api to not segfault when a view has 0 rows --- lib/view.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/view.c b/lib/view.c index 36511ae..e01c036 100644 --- a/lib/view.c +++ b/lib/view.c @@ -71,6 +71,7 @@ static size_t fill_row(View* view, unsigned row, size_t pos) { } static void reflow(View* view) { + if (!view->nrows) return; size_t pos = view->rows[0]->off; for (size_t y = 0; y < view->nrows; y++) pos = fill_row(view, y, pos); @@ -140,6 +141,7 @@ static void sync_center(View* view, size_t csr) { } static void sync_view(View* view, size_t csr) { + if (!view->nrows) return; unsigned first = view->rows[0]->off; unsigned last = view->rows[view->nrows-1]->off + view->rows[view->nrows-1]->rlen - 1; while (csr < first) -- 2.52.0