From 91786a70ed2dbb003e12d6d33ca72593b70b6290 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 20 Jan 2024 16:41:13 -0500 Subject: Fix writing empty list objects within blank nodes --- src/writer.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') 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)); -- cgit v1.2.1