From 8e4c4e44783e55b2766f33e711bd7fc04bf6d206 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 23 Sep 2023 19:53:29 -0400 Subject: Fix crash when plugins pass NULL to the LV2_State_Retrieve_Function --- NEWS | 3 ++- src/state.c | 12 +++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index c3a294d..1379240 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,7 @@ lilv (0.24.21) unstable; urgency=medium * Clean up code * Clean up inconsistent tool command line interfaces * Convert man pages to mdoc + * Fix crash when plugins pass NULL to the LV2_State_Retrieve_Function * Fix dependencies in pkg-config file * Fix potential crash when writing state files fails * Order plugin classes by URI @@ -12,7 +13,7 @@ lilv (0.24.21) unstable; urgency=medium * Replace duplicated dox_to_sphinx script with sphinxygen dependency * Switch to external zix dependency - -- David Robillard Tue, 27 Jun 2023 04:08:59 +0000 + -- David Robillard Sat, 23 Sep 2023 23:52:00 +0000 lilv (0.24.20) stable; urgency=medium diff --git a/src/state.c b/src/state.c index e67714d..c8e8f14 100644 --- a/src/state.c +++ b/src/state.c @@ -226,9 +226,15 @@ retrieve_callback(LV2_State_Handle handle, const Property* const prop = find_property((const LilvState*)handle, key); if (prop) { - *size = prop->size; - *type = prop->type; - *flags = prop->flags; + if (size) { + *size = prop->size; + } + if (type) { + *type = prop->type; + } + if (flags) { + *flags = prop->flags; + } return prop->value; } return NULL; -- cgit v1.2.1