From e5d7d7aaccda5fe8d6643097e3f890ea07cc0a10 Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Mon, 12 Jan 2026 19:47:40 +0100 Subject: [PATCH] extra protection --- wled00/bus_manager.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wled00/bus_manager.cpp b/wled00/bus_manager.cpp index fbe78898..dbd8ffae 100644 --- a/wled00/bus_manager.cpp +++ b/wled00/bus_manager.cpp @@ -1309,7 +1309,8 @@ int BusManager::add(BusConfig &bc) { if (!theBus->isOk()) continue; // check for overlap unsigned theStart = theBus->getStart(); - unsigned theEnd = theStart + theBus->getLength() - 1; + unsigned theLen = theBus->getLength(); + unsigned theEnd = (theLen > 0) ? theStart + theLen - 1 : theStart; // see https://stackoverflow.com/questions/3269434/whats-the-most-efficient-way-to-test-if-two-ranges-overlap if ((newStart <= theEnd) && (theStart <= newEnd)) { // catches all overlap scenarios - including "new is including (around) another range" foundOverlap = true;