aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2016-09-17 20:27:12 -0400
committerDavid Robillard <d@drobilla.net>2016-09-18 10:16:49 -0400
commit3c9dbc63d82b40df08041d7b0cc070fae53efe8f (patch)
tree9c8b8d53f41cd1985ee91da69a44c5c6ffe0a918
parentb2f97ef0f914d4019d283ed534eed1a72a222b5b (diff)
downloadlv2-3c9dbc63d82b40df08041d7b0cc070fae53efe8f.tar.xz
Make lv2_features_data() tolerant of NULL features
-rw-r--r--lv2/lv2plug.in/ns/lv2core/lv2_util.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/lv2/lv2plug.in/ns/lv2core/lv2_util.h b/lv2/lv2plug.in/ns/lv2core/lv2_util.h
index 038b5a6..561e201 100644
--- a/lv2/lv2plug.in/ns/lv2core/lv2_util.h
+++ b/lv2/lv2plug.in/ns/lv2core/lv2_util.h
@@ -41,9 +41,11 @@ static inline void*
lv2_features_data(const LV2_Feature*const* features,
const char* const uri)
{
- for (const LV2_Feature*const* f = features; *f; ++f) {
- if (!strcmp(uri, (*f)->URI)) {
- return (*f)->data;
+ if (features) {
+ for (const LV2_Feature*const* f = features; *f; ++f) {
+ if (!strcmp(uri, (*f)->URI)) {
+ return (*f)->data;
+ }
}
}
return NULL;