summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--utils/nsurl.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/utils/nsurl.c b/utils/nsurl.c
index 20dc10632..bae757324 100644
--- a/utils/nsurl.c
+++ b/utils/nsurl.c
@@ -1506,11 +1506,13 @@ nserror nsurl_join(const nsurl *base, const char *rel, nsurl **joined)
* space for path merging (if required). */
if (joined_parts & NSURL_F_MERGED_PATH) {
/* Need to merge paths */
- length += lwc_string_length(base->path);
+ length += (base->path != NULL) ?
+ lwc_string_length(base->path) : 0;
}
length *= 4;
/* Plus space for removing dots from path */
- length += (m.query - m.path) + lwc_string_length(base->path);
+ length += (m.query - m.path) + ((base->path != NULL) ?
+ lwc_string_length(base->path) : 0);
buff = malloc(length + 5);
if (buff == NULL) {
free(*joined);