From a411ce18c9f2583a12a005205acd1eeb212413d6 Mon Sep 17 00:00:00 2001 From: Milek7 Date: Sun, 12 Jan 2020 14:56:27 +0100 Subject: Fix: avoid using string pointer after scope end --- src/music_gui.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/music_gui.cpp b/src/music_gui.cpp index 7bae6dc1e..d15025ea3 100644 --- a/src/music_gui.cpp +++ b/src/music_gui.cpp @@ -732,11 +732,12 @@ struct MusicWindow : public Window { case WID_M_TRACK_NAME: { GfxFillRect(r.left, r.top + 1, r.right - 1, r.bottom, PC_BLACK); StringID str = STR_MUSIC_TITLE_NONE; + MusicSystem::PlaylistEntry entry(_music.GetCurrentSong()); if (BaseMusic::GetUsedSet()->num_available == 0) { str = STR_MUSIC_TITLE_NOMUSIC; } else if (_music.IsPlaying()) { str = STR_MUSIC_TITLE_NAME; - SetDParamStr(0, _music.GetCurrentSong().songname); + SetDParamStr(0, entry.songname); } DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, str, TC_FROMSTRING, SA_HOR_CENTER); break; -- cgit v1.2.3-70-g09d2