aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2019-03-10 10:14:08 +0100
committerDavid Robillard <d@drobilla.net>2020-10-27 13:13:58 +0100
commit1419387e8becd183273337a746086d4b6b339280 (patch)
tree41a66c659870008478b468ac5d06e2bc021ccad3 /src
parentfd965bf19c00552c4e9268eb73af4eda39437980 (diff)
downloadserd-1419387e8becd183273337a746086d4b6b339280.tar.gz
serd-1419387e8becd183273337a746086d4b6b339280.tar.bz2
serd-1419387e8becd183273337a746086d4b6b339280.zip
Simplify writer statement validity checking
Diffstat (limited to 'src')
-rw-r--r--src/writer.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/writer.c b/src/writer.c
index 99a9beac..df513342 100644
--- a/src/writer.c
+++ b/src/writer.c
@@ -702,7 +702,7 @@ write_node(SerdWriter* writer,
static inline bool
is_resource(const SerdNode* node)
{
- return node->type > SERD_LITERAL;
+ return node && node->type > SERD_LITERAL;
}
static void
@@ -746,8 +746,7 @@ serd_writer_write_statement(SerdWriter* writer,
const SerdNode* const object = serd_statement_object(statement);
const SerdNode* const graph = serd_statement_graph(statement);
- if (!subject || !predicate || !object ||
- !is_resource(subject) || !is_resource(predicate)) {
+ if (!is_resource(subject) || !is_resource(predicate) || !object) {
return SERD_ERR_BAD_ARG;
}