Prevent errors from missing MIDI instruments

This commit is contained in:
StyledStrike 2023-08-11 12:05:18 -03:00
parent 3963e9e16b
commit 97e3c6353d

View File

@ -220,7 +220,7 @@ function MKeyboard:OnNoteOn( note, velocity, instrument, isMidi )
velocity = velocity or self.settings.velocity
instrument = instrument or self.settings.instrument
local instr = self.instruments[instrument]
local instr = self.instruments[instrument] or self.instruments[1]
if note < instr.firstNote or note > instr.lastNote then return end
self.entity:EmitNote( note, velocity, 80, instrument, isMidi )