inactive segments robustness improvement
* Avoid uint16 underflow in width() and height(): stop > start is possible, and means "inactive segment". Without these checks, it was possible that width() and height() produce VERY large values due to underflow.
This commit is contained in:
@@ -729,7 +729,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(); // avoids negative pixel index (stop = 0 is a possible value)
|
||||
return strip.getPixelColor(i);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user