diff --git a/src/MIDI_Interfaces/USBMIDI/LowLevel/BulkTX.ipp b/src/MIDI_Interfaces/USBMIDI/LowLevel/BulkTX.ipp index 673efbf0ea..a4a691a20d 100644 --- a/src/MIDI_Interfaces/USBMIDI/LowLevel/BulkTX.ipp +++ b/src/MIDI_Interfaces/USBMIDI/LowLevel/BulkTX.ipp @@ -51,7 +51,14 @@ void BulkTX::write( return; } const uint32_t *end = msgs + num_msgs; - while (msgs != end) msgs += write_impl(msgs, end - msgs); + while (msgs != end) { + auto sent = write_impl(msgs, end - msgs); + if (sent == 0 && !wait_connect()) { + writing.error.fetch_add(end - msgs, mo_rlx); + return; + } + msgs += sent; + } } template