diff options
author | Eugene Sandulenko | 2016-05-08 23:17:28 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2016-05-08 23:17:28 +0200 |
commit | a05f2121a16368d4d7946cd65390f7668e6fbe2f (patch) | |
tree | 7284ba55f38ba1a773b0e644c6ced9ad30dcbc5c /engines | |
parent | 95884c396b667e048af933292f40fc18da2cefd1 (diff) | |
download | scummvm-rg350-a05f2121a16368d4d7946cd65390f7668e6fbe2f.tar.gz scummvm-rg350-a05f2121a16368d4d7946cd65390f7668e6fbe2f.tar.bz2 scummvm-rg350-a05f2121a16368d4d7946cd65390f7668e6fbe2f.zip |
SCUMM HE: Safeguard division by zero
Diffstat (limited to 'engines')
-rw-r--r-- | engines/scumm/he/sound_he.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/engines/scumm/he/sound_he.cpp b/engines/scumm/he/sound_he.cpp index 9a456b86c0..2e0a03af7f 100644 --- a/engines/scumm/he/sound_he.cpp +++ b/engines/scumm/he/sound_he.cpp @@ -470,6 +470,10 @@ void SoundHE::processSoundOpcodes(int sound, byte *codePtr, int *soundVars) { if (arg == 2) { val = getSoundVar(sound, val); } + if (!val) { + val = 1; // Safeguard for division by zero + warning("Incorrect value 0 for processSoundOpcodes() kludge DIV"); + } val = getSoundVar(sound, var) / val; setSoundVar(sound, var, val); break; |