** Fix for bug #461979
authorMilan Crha <mcrha@redhat.com>
Fri, 23 Nov 2007 10:05:35 +0000 (10:05 +0000)
committerMilan Crha <mcrha@src.gnome.org>
Fri, 23 Nov 2007 10:05:35 +0000 (10:05 +0000)
2007-11-23  Milan Crha  <mcrha@redhat.com>

** 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=/trunk/; revision=8236

camel/ChangeLog
camel/camel-url.c

index adef085..a5f5537 100644 (file)
@@ -1,3 +1,10 @@
+2007-11-23  Milan Crha  <mcrha@redhat.com>
+
+       ** 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  <mcrha@redhat.com>
 
        ** Fix for bug #376425
index 530ad63..397bb3d 100644 (file)
@@ -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),