aboutsummaryrefslogtreecommitdiffstats
path: root/src/env.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/env.c')
-rw-r--r--src/env.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/env.c b/src/env.c
index 29df5286..49d2efa2 100644
--- a/src/env.c
+++ b/src/env.c
@@ -115,7 +115,7 @@ serd_env_base_uri_view(const SerdEnv* env)
const SerdNode*
serd_env_base_uri(const SerdEnv* env)
{
- return env->base_uri_node;
+ return env ? env->base_uri_node : NULL;
}
SerdStatus
@@ -202,6 +202,10 @@ serd_env_qualify_in_place(const SerdEnv* env,
const SerdNode** prefix,
SerdStringView* suffix)
{
+ if (!env) {
+ return false;
+ }
+
for (size_t i = 0; i < env->n_prefixes; ++i) {
const SerdNode* const prefix_uri = env->prefixes[i].uri;
if (uri->n_bytes >= prefix_uri->n_bytes) {
@@ -244,6 +248,10 @@ serd_env_expand_in_place(const SerdEnv* env,
SerdStringView* uri_prefix,
SerdStringView* uri_suffix)
{
+ if (!env) {
+ return SERD_ERR_BAD_CURIE;
+ }
+
const char* const str = serd_node_string(curie);
const char* const colon = (const char*)memchr(str, ':', curie->n_bytes + 1);
if (curie->type != SERD_CURIE || !colon) {