aboutsummaryrefslogtreecommitdiffstats
path: root/src/writer.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2024-01-20 16:41:13 -0500
committerDavid Robillard <d@drobilla.net>2024-01-20 16:41:13 -0500
commit91786a70ed2dbb003e12d6d33ca72593b70b6290 (patch)
tree85888e9896256af81fef040738c1a9a6ac2c24a1 /src/writer.c
parent117ae267046ed564684793270b82767c585c724b (diff)
downloadserd-91786a70ed2dbb003e12d6d33ca72593b70b6290.tar.gz
serd-91786a70ed2dbb003e12d6d33ca72593b70b6290.tar.bz2
serd-91786a70ed2dbb003e12d6d33ca72593b70b6290.zip
Fix writing empty list objects within blank nodes
Diffstat (limited to 'src/writer.c')
-rw-r--r--src/writer.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/writer.c b/src/writer.c
index bdcb8e8e..52badc46 100644
--- a/src/writer.c
+++ b/src/writer.c
@@ -964,6 +964,14 @@ serd_writer_write_statement(SerdWriter* writer,
return SERD_ERR_BAD_ARG;
}
+ if ((flags & SERD_LIST_O_BEGIN) &&
+ !strcmp((const char*)object->buf, NS_RDF "nil")) {
+ /* Tolerate LIST_O_BEGIN for "()" objects, even though it doesn't make
+ much sense, because older versions handled this gracefully. Consider
+ making this an error in a later major version. */
+ flags &= (SerdStatementFlags)~SERD_LIST_O_BEGIN;
+ }
+
// Simple case: write a line of NTriples or NQuads
if (writer->syntax == SERD_NTRIPLES || writer->syntax == SERD_NQUADS) {
TRY(st, write_node(writer, subject, NULL, NULL, FIELD_SUBJECT, flags));