summaryrefslogtreecommitdiff
path: root/lv2/lv2.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2013-03-13 18:38:37 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2013-03-13 18:38:37 +0100
commitc17046353762a0893914e671f1f19eadce6f94f5 (patch)
treeed32175819d765f4f675977f5e44bd2d12422081 /lv2/lv2.cc
parentbb216cf9bc8084a34dd08d8318e390e61161a219 (diff)
Fix crash when host is trying to load NULL config.
Diffstat (limited to 'lv2/lv2.cc')
-rw-r--r--lv2/lv2.cc19
1 files changed, 12 insertions, 7 deletions
diff --git a/lv2/lv2.cc b/lv2/lv2.cc
index bc918fe..87ab09d 100644
--- a/lv2/lv2.cc
+++ b/lv2/lv2.cc
@@ -32,6 +32,8 @@
#include "lv2_instance.h"
+#include <hugin.hpp>
+
#define MIDI_EVENT_URI "http://lv2plug.in/ns/ext/midi#MidiEvent"
#define NS_ATOM "http://lv2plug.in/ns/ext/atom#"
@@ -142,7 +144,7 @@ dg_restore(LV2_Handle instance,
const LV2_Feature *const * features)
{
DGLV2 *dglv2 = (DGLV2 *)instance;
- printf("dg_restore\n");
+ DEBUG(lv2, "dg_restore begin\n");
size_t size;
uint32_t type;
@@ -153,11 +155,14 @@ dg_restore(LV2_Handle instance,
dglv2->urimap->uri_to_id(dglv2->urimap->callback_data,
NULL, NS_DG "config"),
&size, &type, &flags);
- std::string config;
- config.append(data, size - 1);
- dglv2->dg->setConfigString(config);
+ DEBUG(lv2, "Config string size: %d, data*: %p\n", size, data);
- dglv2->in->loadMidiMap(dglv2->dg->midimapfile);
+ if(data) {
+ std::string config;
+ config.append(data, size - 1);
+ dglv2->dg->setConfigString(config);
+ dglv2->in->loadMidiMap(dglv2->dg->midimapfile);
+ }
/*
MyPlugin* plugin = (MyPlugin*)instance;
@@ -175,9 +180,9 @@ dg_restore(LV2_Handle instance,
plugin->state->greeting = strdup(DEFAULT_GREETING);
}
*/
- printf("dg_restore\n");
+ DEBUG(lv2, "dg_restore done\n");
- return LV2_STATE_SUCCESS;
+ return LV2_STATE_SUCCESS;
}
static LV2_State_Interface dg_persist = {