aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/eg-sampler.lv2/sampler.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-08-31 16:28:37 +0000
committerDavid Robillard <d@drobilla.net>2012-08-31 16:28:37 +0000
commit1c06e3e0e46e2e5ac621001b96a2b439aafd2800 (patch)
tree61a7df9939d7596968036e367bd0c795b9679aea /plugins/eg-sampler.lv2/sampler.c
parent39c8d7042573c86b43f53f1849b0b9c4012b021d (diff)
downloadlv2-1c06e3e0e46e2e5ac621001b96a2b439aafd2800.tar.xz
Fix crash on save when no sample is loaded.
Diffstat (limited to 'plugins/eg-sampler.lv2/sampler.c')
-rw-r--r--plugins/eg-sampler.lv2/sampler.c9
1 files changed, 6 insertions, 3 deletions
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,