aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/uri.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/uri.c b/src/uri.c
index 36e978f2..54ff1bba 100644
--- a/src/uri.c
+++ b/src/uri.c
@@ -448,7 +448,8 @@ serd_uri_serialise_relative(const SerdURI* uri,
if (uri->authority.buf) {
len += sink("//", 2, stream);
len += sink(uri->authority.buf, uri->authority.len, stream);
- if (uri->authority.buf[uri->authority.len - 1] != '/' &&
+ if (uri->authority.len > 0 &&
+ uri->authority.buf[uri->authority.len - 1] != '/' &&
serd_uri_path_starts_without_slash(uri)) {
// Special case: ensure path begins with a slash
// https://tools.ietf.org/html/rfc3986#section-3.2