aboutsummaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorGregory Montoir2005-04-13 19:50:58 +0000
committerGregory Montoir2005-04-13 19:50:58 +0000
commit0f3ab2206ae3ed22ed190fb3e46bbccc54e432bf (patch)
tree3dd8857e82a502ad2f64ebcb76f50da6e3486c27 /sound
parentdbfd703d5123459fa92410f3c33b62a9840e53b3 (diff)
downloadscummvm-rg350-0f3ab2206ae3ed22ed190fb3e46bbccc54e432bf.tar.gz
scummvm-rg350-0f3ab2206ae3ed22ed190fb3e46bbccc54e432bf.tar.bz2
scummvm-rg350-0f3ab2206ae3ed22ed190fb3e46bbccc54e432bf.zip
Only cache a track if it really exists, this should prevent some issues when playing with invalid compressed tracks. See also bug report #1181979.
svn-id: r17591
Diffstat (limited to 'sound')
-rw-r--r--sound/audiocd.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/sound/audiocd.cpp b/sound/audiocd.cpp
index 3188d03cee..e287255d47 100644
--- a/sound/audiocd.cpp
+++ b/sound/audiocd.cpp
@@ -151,14 +151,15 @@ int AudioCDManager::getCachedTrack(int track) {
// First, delete the previous track info object
delete _track_info[current_index];
_track_info[current_index] = NULL;
-
- _cached_tracks[current_index] = track;
+ _cached_tracks[current_index] = 0;
for (i = 0; i < ARRAYSIZE(TRACK_FORMATS)-1 && _track_info[current_index] == NULL; ++i)
_track_info[current_index] = TRACK_FORMATS[i].openTrackFunction(track);
- if (_track_info[current_index] != NULL)
+ if (_track_info[current_index] != NULL) {
+ _cached_tracks[current_index] = track;
return current_index;
+ }
debug(2, "Track %d not available in compressed format", track);
return -1;