minor bugfixes as suggested by the rabbit

- PulLightControl UM: dont release a lock you do not own
- off-by-one error in extractModeSlider (used only in rotary in UM)
- safety check in playlist in case something goes horribly wrong
This commit is contained in:
Damian Schneider
2025-12-29 12:56:06 +01:00
committed by Frank
parent 62d938d8ba
commit b2578703b2
2 changed files with 3 additions and 2 deletions

View File

@@ -90,6 +90,7 @@ int16_t loadPlaylist(JsonObject playlistObj, byte presetId) {
it++; it++;
} }
} }
if (it > 0) // should never happen but just in case
for (int i = it; i < playlistLen; i++) playlistEntries[i].dur = playlistEntries[it -1].dur; for (int i = it; i < playlistLen; i++) playlistEntries[i].dur = playlistEntries[it -1].dur;
it = 0; it = 0;

View File

@@ -378,7 +378,7 @@ uint8_t extractModeSlider(uint8_t mode, uint8_t slider, char *dest, uint8_t maxL
case 0: strncpy_P(dest, PSTR("FX Speed"), maxLen); break; case 0: strncpy_P(dest, PSTR("FX Speed"), maxLen); break;
case 1: strncpy_P(dest, PSTR("FX Intensity"), maxLen); break; case 1: strncpy_P(dest, PSTR("FX Intensity"), maxLen); break;
} }
dest[maxLen] = '\0'; // strncpy does not necessarily null terminate string dest[maxLen-1] = '\0'; // strncpy does not necessarily null terminate string
} }
} }
return strlen(dest); return strlen(dest);