aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-11-13 12:48:37 +0100
committerDavid Robillard <d@drobilla.net>2020-11-13 12:53:28 +0100
commit65d6229274ac4e0e076089a66962442ff455d877 (patch)
treed9b413bfdd35c333453a8fe3711fa6f762fbd794 /src
parente04aa68fb7f97c027f427f8b95f4bbd982c63854 (diff)
downloadserd-65d6229274ac4e0e076089a66962442ff455d877.tar.gz
serd-65d6229274ac4e0e076089a66962442ff455d877.tar.bz2
serd-65d6229274ac4e0e076089a66962442ff455d877.zip
Simplify writer statement validity checking
Diffstat (limited to 'src')
-rw-r--r--src/writer.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/writer.c b/src/writer.c
index c821d904..10d5eed9 100644
--- a/src/writer.c
+++ b/src/writer.c
@@ -664,7 +664,7 @@ write_node(SerdWriter* writer,
static inline bool
is_resource(const SerdNode* node)
{
- return node->type > SERD_LITERAL;
+ return node && node->buf && node->type > SERD_LITERAL;
}
static void
@@ -694,7 +694,6 @@ write_list_obj(SerdWriter* writer,
return false;
}
-// TODO: Make subject, predicate,object nonnull in next major release
SerdStatus
serd_writer_write_statement(SerdWriter* writer,
SerdStatementFlags flags,
@@ -705,9 +704,8 @@ serd_writer_write_statement(SerdWriter* writer,
const SerdNode* datatype,
const SerdNode* lang)
{
- if (!subject || !predicate || !object
- || !subject->buf || !predicate->buf || !object->buf
- || !is_resource(subject) || !is_resource(predicate)) {
+ if (!is_resource(subject) || !is_resource(predicate) || !object ||
+ !object->buf) {
return SERD_ERR_BAD_ARG;
}