File tree Expand file tree Collapse file tree 3 files changed +14
-2
lines changed
Expand file tree Collapse file tree 3 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -166,6 +166,7 @@ class PinManagerClass {
166166};
167167
168168// playlist.cpp
169+ void unloadPlaylist ();
169170void loadPlaylist (JsonObject playlistObject);
170171void handlePlaylist ();
171172
Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ void toggleOnOff()
3030 {
3131 briLast = bri;
3232 bri = 0 ;
33+ unloadPlaylist ();
3334 }
3435}
3536
Original file line number Diff line number Diff line change @@ -74,9 +74,19 @@ void serializePlaylist() {
7474}
7575*/
7676
77+ void unloadPlaylist () {
78+ if (playlistEntries != nullptr ) {
79+ delete[] playlistEntries;
80+ playlistEntries = nullptr ;
81+ }
82+ currentPlaylist = playlistIndex = -1 ;
83+ playlistLen = playlistEntryDur = 0 ;
84+ }
85+
7786void loadPlaylist (JsonObject playlistObj) {
78- if (playlistEntries != nullptr ) {delete[] playlistEntries; playlistEntries = nullptr ;}
79- currentPlaylist = playlistIndex = -1 ; playlistEntryDur = 0 ;
87+
88+ unloadPlaylist ();
89+
8090 JsonArray presets = playlistObj[" ps" ];
8191 playlistLen = presets.size ();
8292 if (playlistLen == 0 ) return ;
You can’t perform that action at this time.
0 commit comments