summaryrefslogtreecommitdiff
path: root/libs/ardour/io.cc
diff options
context:
space:
mode:
authorJulien "_FrnchFrgg_" RIVAUD <frnchfrgg@free.fr>2016-07-09 00:19:44 +0200
committerJulien "_FrnchFrgg_" RIVAUD <frnchfrgg@free.fr>2016-07-09 01:21:27 +0200
commitd6534eb143dbd9308d0ed1985c6d00ad50c9dec8 (patch)
treecd915b2de0ce3fda9972554629f086a2dc61c1bf /libs/ardour/io.cc
parentac923be7af7acf6e677cf76b162d5a8d315a7614 (diff)
Assert that nobody calls IO::copy_to_output with empty bufs
IO::copy_to_output() crashed if there was no channel to copy from. Since all callers seem to check before calling, just assert() that it is not the case.
Diffstat (limited to 'libs/ardour/io.cc')
-rw-r--r--libs/ardour/io.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc
index 6d15d58478..ab667815cc 100644
--- a/libs/ardour/io.cc
+++ b/libs/ardour/io.cc
@@ -1721,12 +1721,14 @@ IO::collect_input (BufferSet& bufs, pframes_t nframes, ChanCount offset)
void
IO::copy_to_outputs (BufferSet& bufs, DataType type, pframes_t nframes, framecnt_t offset)
{
- // Copy any buffers 1:1 to outputs
-
PortSet::iterator o = _ports.begin(type);
BufferSet::iterator i = bufs.begin(type);
BufferSet::iterator prev = i;
+ assert(i != bufs.end(type)); // or second loop will crash
+
+ // Copy any buffers 1:1 to outputs
+
while (i != bufs.end(type) && o != _ports.end (type)) {
Buffer& port_buffer (o->get_buffer (nframes));
port_buffer.read_from (*i, nframes, offset);