aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2021-05-30 00:33:25 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2021-05-30 00:33:25 +0800
commit28402bb0af8d1ca1e1c6c9408ebe18738c19c0da (patch)
tree6488fcd36bdc0c2ce62179bbc18f7e1f3d0a6998 /core
parentd429de6a282ce17f04bacfa3a0c855fc0682851b (diff)
downloadQMidiPlayer-28402bb0af8d1ca1e1c6c9408ebe18738c19c0da.tar.xz
Fix certain sysex messages causing crashes.
Diffstat (limited to 'core')
-rw-r--r--core/qmpmidioutrtmidi.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/core/qmpmidioutrtmidi.cpp b/core/qmpmidioutrtmidi.cpp
index f9fcab3..b677c9f 100644
--- a/core/qmpmidioutrtmidi.cpp
+++ b/core/qmpmidioutrtmidi.cpp
@@ -271,12 +271,14 @@ void qmpMidiOutRtMidi::extendedMessage(uint32_t length, const char *data)
{
fprintf(stderr, "Failed to send midi message: %s\n", e.what());
}
- for (auto &msg : devinit->initseq.eventList)
+ if (!devinit)
+ return;
+ for (auto &imsg : devinit->initseq.eventList)
{
- if ((msg.type & 0xF0) == 0xF0 && msg.str == std::string(data, length))
+ if ((imsg.type & 0xF0) == 0xF0 && imsg.str == std::string(data, length))
{
- if (msg.time > 0)
- std::this_thread::sleep_for(std::chrono::milliseconds(msg.time));
+ if (imsg.time > 0)
+ std::this_thread::sleep_for(std::chrono::milliseconds(imsg.time));
}
}
}