robustness improvements

* handling of stop = 0 when calculating sizes (avoid unsigned underflow)
* make sure groupLength() is never zero (to avoid div/0)
* gapmaps: check for "(gapSize > 0)" added.

not sure if all the checks are 100% needed, but they will improve robustness in corner cases.
This commit is contained in:
Frank
2023-06-21 13:30:40 +02:00
parent 310daa61a8
commit 582b96f846
5 changed files with 8 additions and 7 deletions

View File

@@ -1050,7 +1050,7 @@ uint32_t Segment::getPixelColor(int i)
i += start;
/* offset/phase */
i += offset;
if (i >= stop) i -= length();
if ((i >= stop) && (stop>0)) i -= length(); // WLEDMM avoid negative index (stop = 0 is a possible value)
return strip.getPixelColor(i);
}