From 9b8f18073e634da1a10cd03967eaef5597c415cc Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 11 Aug 2020 17:31:21 +0200 Subject: Clean up Env tests and behaviour --- src/env.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/env.c b/src/env.c index 11655134..27e29a66 100644 --- a/src/env.c +++ b/src/env.c @@ -121,6 +121,7 @@ serd_env_set_base_uri(SerdEnv* env, serd_node_free(env->base_uri_node); env->base_uri_node = NULL; env->base_uri = SERD_URI_NULL; + return SERD_SUCCESS; } // Resolve base URI and create a new node and URI for it @@ -181,11 +182,13 @@ serd_env_set_prefix(SerdEnv* env, const SerdNode* name, const SerdNode* uri) { - if (!name || uri->type != SERD_URI) { + if (!name || name->type != SERD_LITERAL || uri->type != SERD_URI) { return SERD_ERR_BAD_ARG; } else if (serd_uri_string_has_scheme(serd_node_string(uri))) { // Set prefix to absolute URI serd_env_add(env, name, uri); + } else if (!env->base_uri_node) { + return SERD_ERR_BAD_ARG; } else { // Resolve relative URI and create a new node and URI for it SerdNode* abs_uri = serd_new_resolved_uri_i( -- cgit v1.2.1