From c8bdbdd2e74b96a604a1c20dfb8c517cf7b61064 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Fri, 7 Oct 2011 21:16:35 +0000 Subject: Handle joining to a base with no path. svn path=/trunk/netsurf/; revision=12983 --- utils/nsurl.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'utils') 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); -- cgit v1.2.3