diff options
author | Milek7 <Milek7@users.noreply.github.com> | 2020-01-12 14:56:27 +0100 |
---|---|---|
committer | Niels Martin Hansen <nielsm@indvikleren.dk> | 2020-01-12 15:20:08 +0100 |
commit | a411ce18c9f2583a12a005205acd1eeb212413d6 (patch) | |
tree | 09fc620a96b9aed9446a1dddf76466e22149efc4 | |
parent | 1225693b9c904144555bb009c7836ef214f4cf87 (diff) | |
download | openttd-a411ce18c9f2583a12a005205acd1eeb212413d6.tar.xz |
Fix: avoid using string pointer after scope end
-rw-r--r-- | src/music_gui.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
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; |