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>2019-04-13 19:48:23 +0200
commitfd342b299f2d46fd0bc79bc3068c5470d59e6a43 (patch)
treed8a7c999331f45cba768b378dbe7ef6c861bd225 /src
parent5aeb95bfa65b61ee64d07cd76905fb071c8a5e17 (diff)
downloadserd-fd342b299f2d46fd0bc79bc3068c5470d59e6a43.tar.gz
serd-fd342b299f2d46fd0bc79bc3068c5470d59e6a43.tar.bz2
serd-fd342b299f2d46fd0bc79bc3068c5470d59e6a43.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 57e5dc92..08e9ae17 100644
--- a/src/writer.c
+++ b/src/writer.c
@@ -677,7 +677,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
@@ -718,8 +718,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;
}