Skip to content

Commit

Permalink
WIN32: Fix invalid array accesses when MIDI device listing fails.
Browse files Browse the repository at this point in the history
  • Loading branch information
Johannes Schickel authored and sev- committed Mar 4, 2016
1 parent 181a3ad commit 9c8b293
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions backends/midi/windows.cpp
Expand Up @@ -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.
Expand Down

0 comments on commit 9c8b293

Please sign in to comment.