aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-05-22 15:16:24 +0200
committerDavid Robillard <d@drobilla.net>2020-10-27 13:13:59 +0100
commitf9c7cac95abb7c5430c9ecd6f0a7220c3f8b5205 (patch)
tree92f318b49d9c9d413e62b40be040cdfde0f8cc33
parent7026fb72f85e349eea64a62bd924358c608520cc (diff)
downloadserd-f9c7cac95abb7c5430c9ecd6f0a7220c3f8b5205.tar.gz
serd-f9c7cac95abb7c5430c9ecd6f0a7220c3f8b5205.tar.bz2
serd-f9c7cac95abb7c5430c9ecd6f0a7220c3f8b5205.zip
Allow setting the base URI of an Env to NULL
-rw-r--r--src/env.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/env.c b/src/env.c
index c8cbf18f..5996b221 100644
--- a/src/env.c
+++ b/src/env.c
@@ -115,8 +115,12 @@ SerdStatus
serd_env_set_base_uri(SerdEnv* env,
const SerdNode* uri)
{
- if (!env || !uri || uri->type != SERD_URI) {
+ if (!env || (uri && uri->type != SERD_URI)) {
return SERD_ERR_BAD_ARG;
+ } else if (!uri) {
+ serd_node_free(env->base_uri_node);
+ env->base_uri_node = NULL;
+ env->base_uri = SERD_URI_NULL;
}
// Resolve base URI and create a new node and URI for it