aboutsummaryrefslogtreecommitdiff
path: root/engines/mads/nebular
diff options
context:
space:
mode:
authorFilippos Karapetis2014-05-16 20:26:49 +0300
committerFilippos Karapetis2014-05-16 20:29:37 +0300
commita197d91df64cb625c6640fdd9fe0a5f74d61a208 (patch)
tree5850eede4185e78aca78b3f785d1714f3aac1180 /engines/mads/nebular
parentede08b748a7af7912ed3dde37eea22a1fb2bb684 (diff)
downloadscummvm-rg350-a197d91df64cb625c6640fdd9fe0a5f74d61a208.tar.gz
scummvm-rg350-a197d91df64cb625c6640fdd9fe0a5f74d61a208.tar.bz2
scummvm-rg350-a197d91df64cb625c6640fdd9fe0a5f74d61a208.zip
MADS: Add a sanity check in pollActiveChannel()
This avoids a crash when Rex is knocked unconscious in scene 318
Diffstat (limited to 'engines/mads/nebular')
-rw-r--r--engines/mads/nebular/sound_nebular.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/engines/mads/nebular/sound_nebular.cpp b/engines/mads/nebular/sound_nebular.cpp
index 5ee34b416f..666b686267 100644
--- a/engines/mads/nebular/sound_nebular.cpp
+++ b/engines/mads/nebular/sound_nebular.cpp
@@ -413,6 +413,10 @@ void ASound::pollActiveChannel() {
if (--_activeChannelPtr->_activeCount <= 0) {
for (;;) {
byte *pSrc = chan->_pSrc;
+ if (!chan->_ptr1) {
+ warning("pollActiveChannel(): No data found for sound channel");
+ break;
+ }
if (!(*pSrc & 0x80) || (*pSrc <= 0xF0)) {
if (updateFlag)
updateActiveChannel();