aboutsummaryrefslogtreecommitdiff
path: root/backends/midi
diff options
context:
space:
mode:
authorJohannes Schickel2016-03-01 01:13:55 +0100
committerJohannes Schickel2016-03-01 01:14:17 +0100
commit1f217e3834a1ff2eceee2012dbfffbaa9b68ff7b (patch)
tree2a33db2b0b5bb63e3bd506c2991f9498746cb703 /backends/midi
parente317958d4cdfb5d4cfe934c577be8f06e8689565 (diff)
downloadscummvm-rg350-1f217e3834a1ff2eceee2012dbfffbaa9b68ff7b.tar.gz
scummvm-rg350-1f217e3834a1ff2eceee2012dbfffbaa9b68ff7b.tar.bz2
scummvm-rg350-1f217e3834a1ff2eceee2012dbfffbaa9b68ff7b.zip
WIN32: Fix invalid array accesses when MIDI device listing fails.
Diffstat (limited to 'backends/midi')
-rw-r--r--backends/midi/windows.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/backends/midi/windows.cpp b/backends/midi/windows.cpp
index e2b327ffa7..52a46200cb 100644
--- a/backends/midi/windows.cpp
+++ b/backends/midi/windows.cpp
@@ -185,6 +185,9 @@ MusicDevices WindowsMusicPlugin::getDevices() const {
deviceNames.push_back(tmp.szPname);
}
+ // Limit us to the number of actually retrieved devices.
+ numDevs = deviceNames.size();
+
// Check for non-unique device names. This may happen if someone has devices with identical
// names (e. g. more than one USB device of the exact same hardware type). It seems that this
// does happen in reality sometimes. We generate index numbers for these devices.