From e5ba97bbe2e077438b5a93ee16406b81f4a8ab75 Mon Sep 17 00:00:00 2001 From: Will Tatam Date: Sun, 27 Jul 2025 13:15:19 +0100 Subject: [PATCH] Prevent crash during blend if led init fails, https://github.com/wled/WLED/issues/4782 --- wled00/FX_fcn.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/wled00/FX_fcn.cpp b/wled00/FX_fcn.cpp index a479b655a..32e34faf9 100755 --- a/wled00/FX_fcn.cpp +++ b/wled00/FX_fcn.cpp @@ -1344,6 +1344,11 @@ void WS2812FX::blendSegment(const Segment &topSegment) const { uint8_t opacity = topSegment.currentBri(); // returns transitioned opacity for style FADE uint8_t cct = topSegment.currentCCT(); + if (length == 1) { + // Can't blend only a single pixel, prevents crash when bus init fails + return; + } + Segment::setClippingRect(0, 0); // disable clipping by default const unsigned dw = (blendingStyle==BLEND_STYLE_OUTSIDE_IN ? progInv : progress) * width / 0xFFFFU + 1;