diff options
-rw-r--r-- | src/plugin.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/plugin.c b/src/plugin.c index 25cc781..cfb3398 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -453,7 +453,9 @@ lilv_plugin_get_port_ranges_float(const LilvPlugin* p, float* def_values) { lilv_plugin_load_ports_if_necessary(p); - LilvNode *min, *max, *def; + LilvNode* min = NULL; + LilvNode* max = NULL; + LilvNode* def = NULL; LilvNode** minptr = min_values ? &min : NULL; LilvNode** maxptr = max_values ? &max : NULL; LilvNode** defptr = def_values ? &def : NULL; @@ -461,17 +463,20 @@ lilv_plugin_get_port_ranges_float(const LilvPlugin* p, for (uint32_t i = 0; i < p->num_ports; ++i) { lilv_port_get_range(p, p->ports[i], defptr, minptr, maxptr); - min_values[i] = (minptr && lilv_node_is_float(min)) - ? lilv_node_as_float(min) - : NAN; + if (min_values) + min_values[i] = lilv_node_is_float(min) + ? lilv_node_as_float(min) + : NAN; - max_values[i] = (maxptr && lilv_node_is_float(max)) - ? lilv_node_as_float(max) - : NAN; + if (max_values) + max_values[i] = lilv_node_is_float(max) + ? lilv_node_as_float(max) + : NAN; - def_values[i] = (defptr && lilv_node_is_float(def)) - ? lilv_node_as_float(def) - : NAN; + if (def_values) + def_values[i] = lilv_node_is_float(def) + ? lilv_node_as_float(def) + : NAN; lilv_node_free(def); lilv_node_free(min); |