$NetBSD: patch-ay,v 1.2 2002/03/24 19:53:49 rh Exp $

--- libgnome/gnome-url.c.orig	Fri Jan 11 08:03:17 2002
+++ libgnome/gnome-url.c
@@ -80,6 +80,8 @@
 	return default_handler;
 }
 
+static int gnome_url_show_with_handler (const gchar *url, const gchar *template);
+
 /**
  * gnome_url_show
  * @url: URL to show
@@ -105,11 +107,11 @@
 void
 gnome_url_show(const gchar *url)
 {
-	gint i;
 	gchar *pos, *template;
 	gboolean free_template = FALSE;
 	int argc;
-       	char **argv;
+	char **argv;
+	int status;
 	
 	g_return_if_fail (url != NULL);
 	pos = strchr (url, ':');
@@ -140,9 +142,23 @@
 	if(poptParseArgvString(template, &argc, &argv) != 0) {
 		/* can't parse */
 		g_warning("Parse error of '%s'", template);
-		return;
+		status = gnome_url_show_with_handler (url, template);
+		if (status == -1 && free_template)
+			gnome_url_show_with_handler (url, gnome_url_default_handler (NULL));
+	} else {
+		gnome_url_show_with_handler (url, template);
 	}
 
+	if (free_template)
+		g_free (template);
+}
+
+static int
+gnome_url_show_with_handler (const gchar *url, const gchar *template)
+{
+	int argc, i, status;
+	char **argv;
+
 	/* we can just replace the entry in the array since the
 	 * array is all in one buffer, we won't leak */
 	for(i = 0; i < argc; i++) {
@@ -154,13 +170,12 @@
 
 	/* use execute async, and not the shell, shell is evil and a
 	 * security hole */
-	gnome_execute_async (NULL, argc, argv);
-
-	if (free_template)
-		g_free (template);
+	status = gnome_execute_async (NULL, argc, argv);
 
 	/* the way the poptParseArgvString works is that the entire thing
 	 * is allocated as one buffer, so just free will suffice, also
 	 * it must be free and not g_free */
 	free(argv);
+
+	return status;
 }
