summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2011-10-16 19:53:02 +0000
committerrubidium <rubidium@openttd.org>2011-10-16 19:53:02 +0000
commitf04746a9ff50e7f9c3813ef0a8498172743f4c28 (patch)
tree8f13bb611494e55be0b6d949857e3e5da44dd373 /src
parenta78f38fdc0efa342bb2a9a75a1fe0e0550de3d11 (diff)
downloadopenttd-f04746a9ff50e7f9c3813ef0a8498172743f4c28.tar.xz
(svn r23033) -Fix [FS#4776]: the last custom playlist items went lost when the files in the .obm are not contiguous
Diffstat (limited to 'src')
-rw-r--r--src/music_gui.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/music_gui.cpp b/src/music_gui.cpp
index ec2999c95..94e3f191b 100644
--- a/src/music_gui.cpp
+++ b/src/music_gui.cpp
@@ -84,7 +84,8 @@ static byte * const _playlists[] = {
void ValidatePlaylist(byte *playlist)
{
while (*playlist != 0) {
- if (*playlist <= BaseMusic::GetUsedSet()->num_available) {
+ /* Song indices are saved off-by-one so 0 is "nothing". */
+ if (*playlist <= NUM_SONGS_AVAILABLE && !StrEmpty(GetSongName(*playlist - 1))) {
playlist++;
continue;
}