From 1c06e3e0e46e2e5ac621001b96a2b439aafd2800 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 31 Aug 2012 16:28:37 +0000 Subject: Fix crash on save when no sample is loaded. --- plugins/eg-sampler.lv2/sampler.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'plugins/eg-sampler.lv2/sampler.c') diff --git a/plugins/eg-sampler.lv2/sampler.c b/plugins/eg-sampler.lv2/sampler.c index 28b455b..7d5c81c 100644 --- a/plugins/eg-sampler.lv2/sampler.c +++ b/plugins/eg-sampler.lv2/sampler.c @@ -421,6 +421,11 @@ save(LV2_Handle instance, uint32_t flags, const LV2_Feature* const* features) { + Sampler* self = (Sampler*)instance; + if (!self->sample) { + return LV2_STATE_SUCCESS; + } + LV2_State_Map_Path* map_path = NULL; for (int i = 0; features[i]; ++i) { if (!strcmp(features[i]->URI, LV2_STATE__mapPath)) { @@ -428,9 +433,7 @@ save(LV2_Handle instance, } } - Sampler* self = (Sampler*)instance; - char* apath = map_path->abstract_path(map_path->handle, - self->sample->path); + char* apath = map_path->abstract_path(map_path->handle, self->sample->path); store(handle, self->uris.eg_file, -- cgit v1.2.1