diff --git a/changelog.md b/changelog.md index 174dad4f..b2165758 100644 --- a/changelog.md +++ b/changelog.md @@ -2,6 +2,7 @@ ## DEV-branch +* 30.11.2023: Fix a nullptr access after trying to replay an invalid filename (#271), thanks to Olaf! * 29.11.2023: Updated audio library to play more MP3s, faster track change & delivery of the cover image * 25.11.2023: Save some cpu time in audio task by only updating the playtime statistics every 250ms * 22.11.2023: Web-UI: Search for files feature #268 diff --git a/html/management.html b/html/management.html index 2270f193..611a51f1 100644 --- a/html/management.html +++ b/html/management.html @@ -1896,7 +1896,11 @@
if (msg.duration > 0) { document.getElementById('playtime').innerHTML = secondsToTime(msg.time) + " / " + secondsToTime(msg.duration); } else { - document.getElementById('playtime').innerHTML = "-- / --"; + if (msg.time > 0) { + document.getElementById('playtime').innerHTML = secondsToTime(msg.time); + } else { + document.getElementById('playtime').innerHTML = "-- / --"; + } } } diff --git a/src/SdCard.cpp b/src/SdCard.cpp index e29746c0..e6b1e1f3 100644 --- a/src/SdCard.cpp +++ b/src/SdCard.cpp @@ -240,6 +240,7 @@ char **SdCard_ReturnPlaylist(const char *fileName, const uint32_t _playMode) { if (files != NULL) { // If **ptr already exists, de-allocate its memory Log_Printf(LOGLEVEL_DEBUG, releaseMemoryOfOldPlaylist, ESP.getFreeHeap()); freeMultiCharArray(files, strtoul(files[0], NULL, 10) + 1); + files = nullptr; Log_Printf(LOGLEVEL_DEBUG, freeMemoryAfterFree, ESP.getFreeHeap()); } @@ -402,6 +403,7 @@ char **SdCard_ReturnPlaylist(const char *fileName, const uint32_t _playMode) { Log_Println(unableToAllocateMemForPlaylist, LOGLEVEL_ERROR); System_IndicateError(); freeMultiCharArray(files, cnt + 1); + files = nullptr; return nullptr; } snprintf(files[0], 5, "%u", cnt); diff --git a/src/revision.h b/src/revision.h index 75a5025d..bd169f12 100644 --- a/src/revision.h +++ b/src/revision.h @@ -1,4 +1,4 @@ #pragma once #include "gitrevision.h" -constexpr const char softwareRevision[] = "Software-revision: 20231129-1-DEV"; +constexpr const char softwareRevision[] = "Software-revision: 20231130-1-DEV";