aboutsummaryrefslogtreecommitdiffstats
path: root/src/env.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-12-25 02:13:27 +0000
committerDavid Robillard <d@drobilla.net>2011-12-25 02:13:27 +0000
commitb2effabfc5d02bab56bae00e7aa138a42bd7d3b6 (patch)
treeba2e9ab5af305b9661fc4e0e79318b8c6676cb85 /src/env.c
parent2501f12f80c3eebed55e5b253ced5a29ac443949 (diff)
downloadserd-b2effabfc5d02bab56bae00e7aa138a42bd7d3b6.tar.gz
serd-b2effabfc5d02bab56bae00e7aa138a42bd7d3b6.tar.bz2
serd-b2effabfc5d02bab56bae00e7aa138a42bd7d3b6.zip
100% test coverage.
git-svn-id: http://svn.drobilla.net/serd/trunk@276 490d8e77-9747-427b-9fa3-0b8f29cee8a0
Diffstat (limited to 'src/env.c')
-rw-r--r--src/env.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/env.c b/src/env.c
index 7abe6791..2a63cf1d 100644
--- a/src/env.c
+++ b/src/env.c
@@ -132,7 +132,9 @@ serd_env_set_prefix(SerdEnv* env,
const SerdNode* name,
const SerdNode* uri_node)
{
- if (serd_uri_string_has_scheme(uri_node->buf)) {
+ if (!name->buf || !uri_node->buf || uri_node->type != SERD_URI) {
+ return SERD_ERR_BAD_ARG;
+ } else if (serd_uri_string_has_scheme(uri_node->buf)) {
// Set prefix to absolute URI
serd_env_add(env, name, uri_node);
} else {
@@ -141,10 +143,6 @@ serd_env_set_prefix(SerdEnv* env,
SerdNode abs_uri_node = serd_node_new_uri_from_node(
uri_node, &env->base_uri, &abs_uri);
- if (!abs_uri_node.buf) {
- return SERD_ERR_BAD_ARG;
- }
-
// Set prefix to resolved (absolute) URI
serd_env_add(env, name, &abs_uri_node);
serd_node_free(&abs_uri_node);