From 890a5badbbeb2ae78ec87b3da827ea2e7eb5aaa9 Mon Sep 17 00:00:00 2001 From: falkTX Date: Sun, 31 May 2020 02:37:39 +0100 Subject: [PATCH] Fix wrong assertion with size 1 MIDI messages in carla-patchbay Closes #1099 Signed-off-by: falkTX --- source/utils/CarlaEngineUtils.hpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/source/utils/CarlaEngineUtils.hpp b/source/utils/CarlaEngineUtils.hpp index e8ce4f5ec..696397087 100644 --- a/source/utils/CarlaEngineUtils.hpp +++ b/source/utils/CarlaEngineUtils.hpp @@ -1,6 +1,6 @@ /* * Carla Engine utils - * Copyright (C) 2011-2018 Filipe Coelho + * Copyright (C) 2011-2020 Filipe Coelho * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -192,8 +192,11 @@ void fillWaterMidiBufferFromEngineEvents(water::MidiBuffer& midiBuffer, const En // set first byte mdataTmp[0] = static_cast(midiEvent.data[0] | (engineEvent.channel & MIDI_CHANNEL_BIT)); - // copy rest - carla_copy(mdataTmp+1, midiEvent.data+1, size-1U); + if (size > 1) + { + // copy rest + carla_copy(mdataTmp+1, midiEvent.data+1, size-1U); + } // done mdataPtr = mdataTmp;