From 112061493cae8a669df359fa929dfd3ff87d7d0e Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 6 Mar 2017 18:58:05 +0100 Subject: Gracefully handle plugins with missing binary URIs --- NEWS | 3 ++- src/instance.c | 12 ++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index d8db3d2..fa3f424 100644 --- a/NEWS +++ b/NEWS @@ -1,10 +1,11 @@ lilv (0.24.3) unstable; + * Gracefully handle plugins with missing binary URIs * Remove use of deprecated readdir_r * Install Python bindings when configured without tests (thanks Clement Skau) - -- David Robillard Mon, 20 Feb 2017 19:38:44 +0100 + -- David Robillard Mon, 06 Mar 2017 18:57:09 +0100 lilv (0.24.2) stable; diff --git a/src/instance.c b/src/instance.c index d05defd..93f0754 100644 --- a/src/instance.c +++ b/src/instance.c @@ -30,10 +30,14 @@ lilv_plugin_instantiate(const LilvPlugin* plugin, return NULL; } - LilvInstance* result = NULL; - const LilvNode* const lib_uri = lilv_plugin_get_library_uri(plugin); - const LilvNode* const bundle_uri = lilv_plugin_get_bundle_uri(plugin); - char* const bundle_path = lilv_file_uri_parse( + LilvInstance* result = NULL; + const LilvNode* const lib_uri = lilv_plugin_get_library_uri(plugin); + const LilvNode* const bundle_uri = lilv_plugin_get_bundle_uri(plugin); + if (!lib_uri || !bundle_uri) { + return NULL; + } + + char* const bundle_path = lilv_file_uri_parse( lilv_node_as_uri(bundle_uri), NULL); LilvLib* lib = lilv_lib_open(plugin->world, lib_uri, bundle_path, features); -- cgit v1.2.1