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:
@@ -115,7 +115,7 @@ void WS2812FX::setUpMatrix() {
|
||||
// 1 ... active pixel (it will count and will be mapped)
|
||||
JsonArray map = doc.as<JsonArray>();
|
||||
gapSize = map.size();
|
||||
if (!map.isNull() && gapSize >= customMappingSize) { // not an empty map
|
||||
if (!map.isNull() && (gapSize > 0) && gapSize >= customMappingSize) { // not an empty map //softhack also check gapSize>0
|
||||
gapTable = new int8_t[gapSize];
|
||||
if (gapTable) for (size_t i = 0; i < gapSize; i++) {
|
||||
gapTable[i] = constrain(map[i], -1, 1);
|
||||
|
||||
Reference in New Issue
Block a user