Skip to content

Commit e5ba97b

Browse files
committed
Prevent crash during blend if led init fails, wled#4782
1 parent b79e81f commit e5ba97b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

wled00/FX_fcn.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1344,6 +1344,11 @@ void WS2812FX::blendSegment(const Segment &topSegment) const {
13441344
uint8_t opacity = topSegment.currentBri(); // returns transitioned opacity for style FADE
13451345
uint8_t cct = topSegment.currentCCT();
13461346

1347+
if (length == 1) {
1348+
// Can't blend only a single pixel, prevents crash when bus init fails
1349+
return;
1350+
}
1351+
13471352
Segment::setClippingRect(0, 0); // disable clipping by default
13481353

13491354
const unsigned dw = (blendingStyle==BLEND_STYLE_OUTSIDE_IN ? progInv : progress) * width / 0xFFFFU + 1;

0 commit comments

Comments
 (0)