From fcb2baf84aa46151a70b1bc37bfe055908532e03 Mon Sep 17 00:00:00 2001 From: klemek Date: Sat, 16 May 2026 18:26:37 +0200 Subject: [PATCH] fix: check return_code of snd_rawmidi_open --- src/midi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/midi.c b/src/midi.c index 7074fcf..964556e 100644 --- a/src/midi.c +++ b/src/midi.c @@ -25,9 +25,9 @@ void midi_open(MidiDevice *device, const char *name, bool log_error) { snd_lib_log_set_handler(snd_no_log); } - snd_rawmidi_open(&device->input, &device->output, name, SND_RAWMIDI_SYNC); - - device->connected = device->input != NULL && device->output != NULL; + device->connected = snd_rawmidi_open(&device->input, &device->output, name, + SND_RAWMIDI_SYNC) == 0 && + device->input != NULL && device->output != NULL; if (log_error) { if (device->connected) { log_info("(%s) MIDI open", name);