aboutsummaryrefslogtreecommitdiff
path: root/src/adlmidi_midiplay.cpp
diff options
context:
space:
mode:
authorWohlstand <admin@wohlnet.ru>2022-11-29 16:43:04 +0300
committerWohlstand <admin@wohlnet.ru>2022-11-29 16:43:04 +0300
commit245d0c98b78be7de8ab81ed1f384d86953947046 (patch)
tree99266f6a624efe363c572aa458d6929fed732e18 /src/adlmidi_midiplay.cpp
parent30df2f828f3e92ce26a0e9348f0e0b1a979f4fc0 (diff)
downloadlibADLMIDI-245d0c98b78be7de8ab81ed1f384d86953947046.tar.gz
libADLMIDI-245d0c98b78be7de8ab81ed1f384d86953947046.tar.bz2
libADLMIDI-245d0c98b78be7de8ab81ed1f384d86953947046.zip
Fixed crash on attempt to change the volume of a blank note
Diffstat (limited to 'src/adlmidi_midiplay.cpp')
-rw-r--r--src/adlmidi_midiplay.cpp5
1 files changed, 3 insertions, 2 deletions
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;
}
}