diff options
author | David Robillard <d@drobilla.net> | 2012-01-17 16:26:59 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-01-17 16:26:59 +0000 |
commit | 3bc7123592b31535567ed1e643d2e6a73d696452 (patch) | |
tree | a6ec99f7a1cef37f39b259cb92700538c0e8207e /src | |
parent | 28d3e857aff90df8179a71481dc452a18f6ee618 (diff) | |
download | jalv-3bc7123592b31535567ed1e643d2e6a73d696452.tar.gz jalv-3bc7123592b31535567ed1e643d2e6a73d696452.tar.bz2 jalv-3bc7123592b31535567ed1e643d2e6a73d696452.zip |
Fix crashes when loading presets with no UI present (fix #808).
git-svn-id: http://svn.drobilla.net/lad/trunk/jalv@3956 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r-- | src/jalv.c | 4 | ||||
-rw-r--r-- | src/state.c | 16 |
2 files changed, 13 insertions, 7 deletions
@@ -486,6 +486,10 @@ jalv_ui_write(SuilController controller, { Jalv* host = (Jalv*)controller; + if (!host->ui) { + return; + } + if (protocol != 0 && protocol != host->atom_prot_id) { fprintf(stderr, "UI write with unsupported protocol %d (%s)\n", protocol, symap_unmap(host->symap, protocol)); diff --git a/src/state.c b/src/state.c index 03362fb..3ef4d3d 100644 --- a/src/state.c +++ b/src/state.c @@ -140,13 +140,15 @@ set_port_value(const char* port_symbol, jalv_ui_write(jalv, port->index, sizeof(fvalue), 0, &fvalue); // Update UI - char buf[sizeof(ControlChange) + sizeof(fvalue)]; - ControlChange* ev = (ControlChange*)buf; - ev->index = port->index; - ev->protocol = 0; - ev->size = sizeof(fvalue); - *(float*)ev->body = fvalue; - jack_ringbuffer_write(jalv->plugin_events, buf, sizeof(buf)); + if (jalv->ui) { + char buf[sizeof(ControlChange) + sizeof(fvalue)]; + ControlChange* ev = (ControlChange*)buf; + ev->index = port->index; + ev->protocol = 0; + ev->size = sizeof(fvalue); + *(float*)ev->body = fvalue; + jack_ringbuffer_write(jalv->plugin_events, buf, sizeof(buf)); + } } void |