summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-02-03 19:48:54 +0000
committerDavid Robillard <d@drobilla.net>2012-02-03 19:48:54 +0000
commitda432dede09224eba86ccc1892722a977f69156d (patch)
treed45e68d6196f21101c6a4dd4051155c1e778ac6a /src
parent77ddfedd0e2ced11aa4c06dab7ad296913a6d20a (diff)
downloadlilv-da432dede09224eba86ccc1892722a977f69156d.tar.gz
lilv-da432dede09224eba86ccc1892722a977f69156d.tar.bz2
lilv-da432dede09224eba86ccc1892722a977f69156d.zip
Gracefully tolerate NULL get_value passed to lilv_state_new_from_instance().
git-svn-id: http://svn.drobilla.net/lad/trunk/lilv@3975 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/state.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/state.c b/src/state.c
index e8e3544..9d039ea 100644
--- a/src/state.c
+++ b/src/state.c
@@ -354,18 +354,20 @@ lilv_state_new_from_instance(const LilvPlugin* plugin,
#endif
// Store port values
- LilvNode* lv2_ControlPort = lilv_new_uri(world, LILV_URI_CONTROL_PORT);
- LilvNode* lv2_InputPort = lilv_new_uri(world, LILV_URI_INPUT_PORT);
- for (uint32_t i = 0; i < plugin->num_ports; ++i) {
- const LilvPort* const port = plugin->ports[i];
- if (lilv_port_is_a(plugin, port, lv2_ControlPort)
- && lilv_port_is_a(plugin, port, lv2_InputPort)) {
- const char* sym = lilv_node_as_string(port->symbol);
- append_port_value(state, sym, get_value(sym, user_data));
+ if (get_value) {
+ LilvNode* lv2_ControlPort = lilv_new_uri(world, LILV_URI_CONTROL_PORT);
+ LilvNode* lv2_InputPort = lilv_new_uri(world, LILV_URI_INPUT_PORT);
+ for (uint32_t i = 0; i < plugin->num_ports; ++i) {
+ const LilvPort* const port = plugin->ports[i];
+ if (lilv_port_is_a(plugin, port, lv2_ControlPort)
+ && lilv_port_is_a(plugin, port, lv2_InputPort)) {
+ const char* sym = lilv_node_as_string(port->symbol);
+ append_port_value(state, sym, get_value(sym, user_data));
+ }
}
+ lilv_node_free(lv2_ControlPort);
+ lilv_node_free(lv2_InputPort);
}
- lilv_node_free(lv2_ControlPort);
- lilv_node_free(lv2_InputPort);
// Store properties
#ifdef HAVE_LV2_STATE