summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2015-03-13 16:25:47 +0000
committerDavid Robillard <d@drobilla.net>2015-03-13 16:25:47 +0000
commitce2db42fb605322bc9758e9c19d802261be63ad1 (patch)
treec8b8e75a16d83b785bdd75a5e916e7791a865af2 /src
parent9dfc082ba0c57385b9bfb82bb1f4f70f968272bb (diff)
downloadingen-ce2db42fb605322bc9758e9c19d802261be63ad1.tar.gz
ingen-ce2db42fb605322bc9758e9c19d802261be63ad1.tar.bz2
ingen-ce2db42fb605322bc9758e9c19d802261be63ad1.zip
Check for options interface before getting.
Fixes crash with plugins that do not define extension_data(). git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@5627 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/server/LV2Block.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/server/LV2Block.cpp b/src/server/LV2Block.cpp
index 64c80764..5ab1dbe1 100644
--- a/src/server/LV2Block.cpp
+++ b/src/server/LV2Block.cpp
@@ -77,8 +77,10 @@ LV2Block::make_instance(URIs& uris,
uint32_t voice,
bool preparing)
{
- LilvInstance* inst = lilv_plugin_instantiate(
- _lv2_plugin->lilv_plugin(), rate, _features->array());
+ LilvWorld* lworld = _lv2_plugin->lv2_info()->lv2_world();
+ const LilvPlugin* lplug = _lv2_plugin->lilv_plugin();
+ LilvInstance* inst = lilv_plugin_instantiate(
+ lplug, rate, _features->array());
if (!inst) {
parent_graph()->engine().log().error(
@@ -87,8 +89,15 @@ LV2Block::make_instance(URIs& uris,
return SPtr<LilvInstance>();
}
- const LV2_Options_Interface* options_iface = (const LV2_Options_Interface*)
- lilv_instance_get_extension_data(inst, LV2_OPTIONS__interface);
+ LilvNode* opt_interface = lilv_new_uri(lworld, LV2_OPTIONS__interface);
+
+ const LV2_Options_Interface* options_iface = NULL;
+ if (lilv_plugin_has_extension_data(lplug, opt_interface)) {
+ options_iface = (const LV2_Options_Interface*)
+ lilv_instance_get_extension_data(inst, LV2_OPTIONS__interface);
+ }
+
+ lilv_node_free(opt_interface);
for (uint32_t p = 0; p < num_ports(); ++p) {
PortImpl* const port = _ports->at(p);