summaryrefslogtreecommitdiff
path: root/libs/ardour/luaproc.cc
diff options
context:
space:
mode:
authorJulien "_FrnchFrgg_" RIVAUD <frnchfrgg@free.fr>2016-07-31 23:43:15 +0200
committerJulien "_FrnchFrgg_" RIVAUD <frnchfrgg@free.fr>2016-08-01 09:46:20 +0200
commite16866416738a3b2089e760fb76d45ff7a59fe3a (patch)
tree8401181ab456d42ea6289a2cab2d4364f4effc93 /libs/ardour/luaproc.cc
parent91414f52e2aeb801820c671062c584cc3f540fdb (diff)
Be more tolerant to missing values or errors in io_config()
Diffstat (limited to 'libs/ardour/luaproc.cc')
-rw-r--r--libs/ardour/luaproc.cc24
1 files changed, 15 insertions, 9 deletions
diff --git a/libs/ardour/luaproc.cc b/libs/ardour/luaproc.cc
index b393a2e00d..af5534e21a 100644
--- a/libs/ardour/luaproc.cc
+++ b/libs/ardour/luaproc.cc
@@ -388,11 +388,13 @@ LuaProc::can_support_io_configuration (const ChanCount& in, ChanCount& out, Chan
const int preferred_out = out.n_audio ();
for (luabridge::Iterator i (iotable); !i.isNil (); ++i) {
- assert (i.value ().type () == LUA_TTABLE);
luabridge::LuaRef io (i.value ());
+ if (!io.isTable()) {
+ continue;
+ }
- int possible_in = io["audio_in"];
- int possible_out = io["audio_out"];
+ int possible_in = io["audio_in"].isNumber() ? io["audio_in"] : -1;
+ int possible_out = io["audio_out"].isNumber() ? io["audio_out"] : -1;
// exact match
if ((possible_in == audio_in) && (possible_out == preferred_out)) {
@@ -428,11 +430,13 @@ LuaProc::can_support_io_configuration (const ChanCount& in, ChanCount& out, Chan
}
for (luabridge::Iterator i (iotable); !i.isNil (); ++i) {
- assert (i.value ().type () == LUA_TTABLE);
luabridge::LuaRef io (i.value ());
+ if (!io.isTable()) {
+ continue;
+ }
- int possible_in = io["audio_in"];
- int possible_out = io["audio_out"];
+ int possible_in = io["audio_in"].isNumber() ? io["audio_in"] : -1;
+ int possible_out = io["audio_out"].isNumber() ? io["audio_out"] : -1;
if (possible_out == 0) {
if (possible_in == 0) {
@@ -563,11 +567,13 @@ LuaProc::can_support_io_configuration (const ChanCount& in, ChanCount& out, Chan
if (!found && imprecise) {
/* try harder */
for (luabridge::Iterator i (iotable); !i.isNil (); ++i) {
- assert (i.value ().type () == LUA_TTABLE);
luabridge::LuaRef io (i.value ());
+ if (!io.isTable()) {
+ continue;
+ }
- int possible_in = io["audio_in"];
- int possible_out = io["audio_out"];
+ int possible_in = io["audio_in"].isNumber() ? io["audio_in"] : -1;
+ int possible_out = io["audio_out"].isNumber() ? io["audio_out"] : -1;
if (possible_out == 0 && possible_in == 0 && _has_midi_output) {
assert (audio_in > 0); // no input is handled above