aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2019-03-10 10:14:08 +0100
committerDavid Robillard <d@drobilla.net>2019-12-20 10:26:55 -0500
commit13a03dc7e1b1b280630b16499daee8e96c4a3fcb (patch)
tree91d30106e6e77f73847af97a8d568696fa53c14d
parent2bc1126e3e6310464adc8e5aea04f15fb4c72341 (diff)
downloadserd-13a03dc7e1b1b280630b16499daee8e96c4a3fcb.tar.gz
serd-13a03dc7e1b1b280630b16499daee8e96c4a3fcb.tar.bz2
serd-13a03dc7e1b1b280630b16499daee8e96c4a3fcb.zip
Simplify writer statement validity checking
-rw-r--r--src/writer.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/writer.c b/src/writer.c
index f187aefc..38dcc240 100644
--- a/src/writer.c
+++ b/src/writer.c
@@ -673,7 +673,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
@@ -714,8 +714,7 @@ serd_writer_write_statement(SerdWriter* writer,
const SerdNode* const object = serd_statement_get_object(statement);
const SerdNode* const graph = serd_statement_get_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;
}