From a593de0836790a3437b861cf0eb7acd1b581e512 Mon Sep 17 00:00:00 2001 From: falkTX Date: Sat, 9 May 2015 20:35:18 +0200 Subject: [PATCH] Fix crash when saving state without a kit loaded --- drmr.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/drmr.c b/drmr.c index 0e63ecc..8c0a128 100644 --- a/drmr.c +++ b/drmr.c @@ -442,16 +442,18 @@ save_state(LV2_Handle instance, return LV2_STATE_ERR_NO_FEATURE; } - char* mapped_path = map_path->abstract_path(map_path->handle, - drmr->current_path); + if (drmr->current_path != NULL) { + char* mapped_path = map_path->abstract_path(map_path->handle, + drmr->current_path); - stat = store(handle, - drmr->uris.kit_path, - mapped_path, - strlen(mapped_path) + 1, - drmr->uris.string_urid, - LV2_STATE_IS_POD | LV2_STATE_IS_PORTABLE); - if (stat) return stat; + stat = store(handle, + drmr->uris.kit_path, + mapped_path, + strlen(mapped_path) + 1, + drmr->uris.string_urid, + LV2_STATE_IS_POD | LV2_STATE_IS_PORTABLE); + if (stat) return stat; + } flag = drmr->ignore_velocity?1:0; stat = store(handle,