aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Brendan Taylor <whateley@gmail.com>2011-09-16 00:13:03 +0000
committerGravatar Brendan Taylor <whateley@gmail.com>2011-09-17 17:04:04 +0000
commitb7936c6a4c8bc01a87bcb38dd8a2ad5660e6282b (patch)
treea74757708d1d1010081947efd43e1135949e7759 /src
parentb327b2147a28a2a81cf591875d3f4aee2aa971d4 (diff)
don't change the page when given a blank URL
Diffstat (limited to 'src')
-rw-r--r--src/variables.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/variables.c b/src/variables.c
index 8f4f611..8ba2785 100644
--- a/src/variables.c
+++ b/src/variables.c
@@ -263,18 +263,18 @@ uri_change_cb (WebKitWebView *web_view, GParamSpec param_spec) {
}
void
-set_uri(const gchar *val) {
- g_free(uzbl.state.uri);
- uzbl.state.uri = g_strdup(val);
- const gchar *uri = uzbl.state.uri;
-
- gchar *newuri;
- SoupURI *soup_uri;
-
- /* Strip leading whitespaces */
+set_uri(const gchar *uri) {
+ /* Strip leading whitespace */
while (*uri && isspace(*uri))
uri++;
+ /* don't do anything when given a blank URL */
+ if(uri[0] == 0)
+ return;
+
+ g_free(uzbl.state.uri);
+ uzbl.state.uri = g_strdup(uri);
+
/* evaluate javascript: URIs */
if (!strncmp (uri, "javascript:", 11)) {
eval_js(uzbl.gui.web_view, uri, NULL, "javascript:");
@@ -282,7 +282,8 @@ set_uri(const gchar *val) {
}
/* attempt to parse the URI */
- soup_uri = soup_uri_new(uri);
+ gchar *newuri;
+ SoupURI *soup_uri = soup_uri_new(uri);
if (!soup_uri) {
/* it's not a valid URI, maybe it's a path on the filesystem. */
@@ -311,8 +312,8 @@ set_uri(const gchar *val) {
}
set_window_property("UZBL_URI", newuri);
-
webkit_web_view_load_uri (uzbl.gui.web_view, newuri);
+
g_free (newuri);
}