aboutsummaryrefslogtreecommitdiff
path: root/engines/gnap/sound.cpp
diff options
context:
space:
mode:
authorStrangerke2016-05-23 19:22:09 +0200
committerStrangerke2016-05-23 19:22:09 +0200
commit94c58f9143a45bbbae74260633f6ca1be6b10597 (patch)
treeebd633762fb9068df6cef7294a8398231d86430b /engines/gnap/sound.cpp
parent7eeb50e488ba4177d635e2396ab6b51ac9601b26 (diff)
downloadscummvm-rg350-94c58f9143a45bbbae74260633f6ca1be6b10597.tar.gz
scummvm-rg350-94c58f9143a45bbbae74260633f6ca1be6b10597.tar.bz2
scummvm-rg350-94c58f9143a45bbbae74260633f6ca1be6b10597.zip
GNAP: Add safeguard in setSoundVolume
Diffstat (limited to 'engines/gnap/sound.cpp')
-rw-r--r--engines/gnap/sound.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/engines/gnap/sound.cpp b/engines/gnap/sound.cpp
index a4a59d7390..75cfb5555c 100644
--- a/engines/gnap/sound.cpp
+++ b/engines/gnap/sound.cpp
@@ -57,6 +57,9 @@ void SoundMan::stopSound(int resourceId) {
}
void SoundMan::setSoundVolume(int resourceId, int volume) {
+ if (resourceId == -1 || volume < 0 || volume > 100)
+ return;
+
const int index = find(resourceId);
int realVol = volume * 2.55;
_vm->_mixer->setChannelVolume(_items[index]._handle, realVol);