From a197d91df64cb625c6640fdd9fe0a5f74d61a208 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 16 May 2014 20:26:49 +0300 Subject: MADS: Add a sanity check in pollActiveChannel() This avoids a crash when Rex is knocked unconscious in scene 318 --- engines/mads/nebular/sound_nebular.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'engines/mads/nebular/sound_nebular.cpp') 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(); -- cgit v1.2.3