diff options
author | David Robillard <d@drobilla.net> | 2011-01-28 23:35:43 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-01-28 23:35:43 +0000 |
commit | cfdea96ce4c01e0aa0bae41e084110d03135f06a (patch) | |
tree | b4ecfdd4395f47d9101f207b4bb1d2f798bfb0a0 /src/writer.c | |
parent | 8addf2ddadd7094d1bb2bc93f6c33796870da226 (diff) | |
download | serd-cfdea96ce4c01e0aa0bae41e084110d03135f06a.tar.gz serd-cfdea96ce4c01e0aa0bae41e084110d03135f06a.tar.bz2 serd-cfdea96ce4c01e0aa0bae41e084110d03135f06a.zip |
Fix crashes when passed NULL nodes.
git-svn-id: http://svn.drobilla.net/serd/trunk@88 490d8e77-9747-427b-9fa3-0b8f29cee8a0
Diffstat (limited to 'src/writer.c')
-rw-r--r-- | src/writer.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/writer.c b/src/writer.c index 9ba02489..dd1d3f7a 100644 --- a/src/writer.c +++ b/src/writer.c @@ -207,10 +207,10 @@ write_node(SerdWriter writer, writer->sink("\"", 1, writer->stream); write_text(writer, WRITE_STRING, node->buf, node->n_bytes - 1, '"'); writer->sink("\"", 1, writer->stream); - if (lang->buf) { + if (lang && lang->buf) { writer->sink("@", 1, writer->stream); writer->sink(lang->buf, lang->n_bytes - 1, writer->stream); - } else if (datatype->buf) { + } else if (datatype && datatype->buf) { writer->sink("^^", 2, writer->stream); write_node(writer, datatype, NULL, NULL); } @@ -316,7 +316,9 @@ serd_writer_write_statement(SerdWriter writer, write_node(writer, object, object_datatype, object_lang); } - const WriteContext new_context = { *graph, *subject, *predicate }; + const WriteContext new_context = { graph ? *graph : SERD_NODE_NULL, + *subject, + *predicate }; writer->context = new_context; return true; } |