From 245d0c98b78be7de8ab81ed1f384d86953947046 Mon Sep 17 00:00:00 2001 From: Wohlstand Date: Tue, 29 Nov 2022 16:43:04 +0300 Subject: Fixed crash on attempt to change the volume of a blank note --- src/adlmidi_midiplay.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/adlmidi_midiplay.cpp b/src/adlmidi_midiplay.cpp index 5576e65..7d20abe 100644 --- a/src/adlmidi_midiplay.cpp +++ b/src/adlmidi_midiplay.cpp @@ -293,10 +293,11 @@ bool MIDIplay::realTime_NoteOn(uint8_t channel, uint8_t note, uint8_t velocity) if(!i.is_end()) { MIDIchannel::NoteInfo &ni = i->value; - const int veloffset = ni.ains->midiVelocityOffset; + const int veloffset = ni.ains ? ni.ains->midiVelocityOffset : 0; velocity = (uint8_t)std::min(127, std::max(1, (int)velocity + veloffset)); ni.vol = velocity; - noteUpdate(channel, i, Upd_Volume); + if(ni.ains) + noteUpdate(channel, i, Upd_Volume); return false; } } -- cgit v1.2.3