From 1db8909da02a99f9931aec6da4fcfb7e79281db1 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 12 Dec 2011 19:22:03 +0000 Subject: Fix crashes caused by serd passing NULL to the statement callback. git-svn-id: http://svn.drobilla.net/sord/trunk@181 3d64ff67-21c5-427c-a301-fe4f08042e5a --- src/sord.c | 6 +++++- src/syntax.c | 1 - 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/sord.c b/src/sord.c index 87dfb10..e32c382 100644 --- a/src/sord.c +++ b/src/sord.c @@ -1009,6 +1009,10 @@ sord_node_from_serd_node(SordWorld* world, const SerdNode* datatype, const SerdNode* lang) { + if (!sn) { + return NULL; + } + SordNode* datatype_node = NULL; SordNode* ret = NULL; switch (sn->type) { @@ -1023,7 +1027,7 @@ sord_node_from_serd_node(SordWorld* world, sn->n_bytes, sn->n_chars, sn->flags, - (const char*)lang->buf); + lang ? (const char*)lang->buf : NULL); sord_node_free(world, datatype_node); return ret; case SERD_URI: diff --git a/src/syntax.c b/src/syntax.c index eb9600f..e69607f 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -70,7 +70,6 @@ event_statement(void* handle, SordNode* g = NULL; if (state->graph_uri_node) { - assert(graph->type == SERD_NOTHING); g = sord_node_copy(state->graph_uri_node); } else { g = (graph && graph->buf) -- cgit v1.2.1