From 5a584068a698e4e21073d5a8fc3bc00bed15c210 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 23 Nov 2007 10:06:03 +0000 Subject: ** Fix for bug #461979 2007-11-23 Milan Crha ** Fix for bug #461979 * camel-url.c: (camel_url_new_with_base): The base URL can be without a path, so do not crash, if that happen. svn path=/branches/gnome-2-20/; revision=8237 --- camel/ChangeLog | 7 +++++++ camel/camel-url.c | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/camel/ChangeLog b/camel/ChangeLog index dc7bde755..08e535733 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,10 @@ +2007-11-23 Milan Crha + + ** Fix for bug #461979 + + * camel-url.c: (camel_url_new_with_base): + The base URL can be without a path, so do not crash, if that happen. + 2007-11-22 Milan Crha ** Fix for bug #376425 diff --git a/camel/camel-url.c b/camel/camel-url.c index 4daa6e9c1..58cd308c7 100644 --- a/camel/camel-url.c +++ b/camel/camel-url.c @@ -224,7 +224,9 @@ camel_url_new_with_base (CamelURL *base, const char *url_string) } else if (*url->path != '/') { char *newpath, *last, *p, *q; - last = strrchr (base->path, '/'); + /* the base->path is NULL if given Content-Base url was without last slash, + i.e. like "http://example.com" (this expected only "http://example.com/") */ + last = base->path ? strrchr (base->path, '/') : NULL; if (last) { newpath = g_strdup_printf ("%.*s/%s", (int)(last - base->path), -- cgit v1.2.1