From e3df2dca16ce495efd62178ea3a1287518e947bd Mon Sep 17 00:00:00 2001 From: nick black Date: Wed, 13 May 2020 07:51:04 -0400 Subject: [PATCH] ncvisual_bounding_box(): always initialize lcol/rcol --- src/lib/visual.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/visual.cpp b/src/lib/visual.cpp index 84596214c..85d6c0490 100644 --- a/src/lib/visual.cpp +++ b/src/lib/visual.cpp @@ -141,7 +141,7 @@ auto ncvisual_setplane(ncvisual* ncv, ncplane* n) -> int { // pixels. Returns the area of the box (0 if there are no pixels). auto ncvisual_bounding_box(const ncvisual* ncv, int* leny, int* lenx, int* offy, int* offx) -> int { - int trow, lcol, rcol; + int trow, lcol = -1, rcol = INT_MAX; // FIXME shouldn't need lcol init // first, find the topmost row with a real pixel. if there is no such row, // there are no such pixels. if we find one, we needn't look in this region // for other extrema, so long as we keep the leftmost and rightmost through @@ -166,7 +166,7 @@ auto ncvisual_bounding_box(const ncvisual* ncv, int* leny, int* lenx, break; } } - if(x < ncv->dstwidth){ + if(rcol < INT_MAX){ break; } }