fix: add NULL checks for clip buffer and MIDI events in process callback

Co-authored-by: aider (deepseek/deepseek-coder) <aider@aider.chat>
This commit is contained in:
Loic Coenen
2026-05-03 20:49:24 +00:00
parent 13cbe0c303
commit b74db49d7f
2 changed files with 9 additions and 5 deletions

View File

@@ -533,7 +533,11 @@ AppState reducer(AppState state, Action action) {
mclip->event_count = 0;
mclip->read_index = 0;
mclip->max_events = MAX_MIDI_EVENTS;
// events pointer should already be valid from init
// Ensure events pointer is valid
if (mclip->events == NULL) {
mclip->events = (MidiEvent *)calloc(MAX_MIDI_EVENTS, sizeof(MidiEvent));
mclip->max_events = MAX_MIDI_EVENTS;
}
}
// Reset Carla host