diff options
author | David Robillard <d@drobilla.net> | 2008-04-30 21:23:42 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2008-04-30 21:23:42 +0000 |
commit | 3eb56c2343e123e20a7cf6864568819f915eb003 (patch) | |
tree | 5762981afe258f46130852a08a9778e19f52f617 | |
parent | 2a6dada56409c0f4e2cf8f353044f45e12ce2d38 (diff) | |
download | ingen-3eb56c2343e123e20a7cf6864568819f915eb003.tar.gz ingen-3eb56c2343e123e20a7cf6864568819f915eb003.tar.bz2 ingen-3eb56c2343e123e20a7cf6864568819f915eb003.zip |
Fix Redland NULL node assertion failures when saving.
git-svn-id: http://svn.drobilla.net/lad/ingen@1184 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r-- | src/libs/serialisation/Serialiser.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/libs/serialisation/Serialiser.cpp b/src/libs/serialisation/Serialiser.cpp index d6bd1df4..d3114082 100644 --- a/src/libs/serialisation/Serialiser.cpp +++ b/src/libs/serialisation/Serialiser.cpp @@ -432,14 +432,23 @@ Serialiser::serialise_variables(Redland::Node subject, const GraphObject::Variab { for (GraphObject::Variables::const_iterator v = variables.begin(); v != variables.end(); ++v) { if (v->first.find(":") != string::npos) { + if (v->second) { const Redland::Node var_id = _world.blank_id(); const Redland::Node key(_model->world(), Redland::Node::RESOURCE, v->first); - _model->add_statement(subject, "ingen:variable", var_id); - _model->add_statement(var_id, "ingen:key", key); - _model->add_statement(var_id, "ingen:value", - AtomRDF::atom_to_node(_model->world(), v->second)); + const Redland::Node value = AtomRDF::atom_to_node(_model->world(), v->second); + if (value) { + _model->add_statement(subject, "ingen:variable", var_id); + _model->add_statement(var_id, "ingen:key", key); + _model->add_statement(var_id, "ingen:value", value); + } else { + cerr << "Warning: can not serialise value: key '" << v->first << "', type " + << (int)v->second.type() << endl; + } + } else { + cerr << "Warning: variable with no value: key '" << v->first << "'" << endl; + } } else { - cerr << "Warning: not serialising variable with key '" << v->first << "'" << endl; + cerr << "Warning: not serialising variable with invalid key '" << v->first << "'" << endl; } } } |