Check for MIDI buffer overflow when merging into an empty buffer
This can happen if the buffers have different sizes.
This fixes crashes that bisected to 7c37a18b7, but it is not the root
cause; it just happened to make things worse.
This commit is contained in:
@@ -442,15 +442,15 @@ MidiBuffer::merge_in_place (const MidiBuffer &other)
|
||||
return true;
|
||||
}
|
||||
|
||||
if (size() + other.size() > _capacity) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (size() == 0) {
|
||||
copy (other);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (size() + other.size() > _capacity) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const_iterator them = other.begin();
|
||||
iterator us = begin();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user