From dfcbacd6305f31df28611f950e55187a66adff6d Mon Sep 17 00:00:00 2001 From: "Ciprian Dorin, Craciun" Date: Sat, 28 Nov 2009 17:39:56 +0200 Subject: Fixed `run_handler (const gchar *act, const gchar *args)` by calling `inject_handler_args` only if `act` contains both a command and some parameters. The problem is: * when `act` has no spaces, > char **parts = g_strsplit(act, " ", 2); * `parts[1]` is `NULL`, and thus the following is wrong, > gchar* expanded = expand(parts[1], 0); > inparts = inject_handler_args(parts[0], expanded, args); * instead `inparts[1]` should be set equal with `args` and no expansion should occur. --- uzbl-core.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'uzbl-core.c') diff --git a/uzbl-core.c b/uzbl-core.c index d14764f..f0870fc 100644 --- a/uzbl-core.c +++ b/uzbl-core.c @@ -2143,15 +2143,25 @@ run_handler (const gchar *act, const gchar *args) { g_strfreev(chainparts); } else { - /* expand the user-specified arguments */ - gchar* expanded = expand(parts[1], 0); - gchar **inparts = inject_handler_args(parts[0], expanded, args); + gchar **inparts; + gchar *inparts_[2]; + if (parts[1]) { + /* expand the user-specified arguments */ + gchar* expanded = expand(parts[1], 0); + inparts = inject_handler_args(parts[0], expanded, args); + g_free(expanded); + } else { + inparts_[0] = parts[0]; + inparts_[1] = args; + inparts = inparts_; + } parse_command(inparts[0], inparts[1], NULL); - g_free(inparts[0]); - g_free(inparts[1]); - g_free(expanded); + if (inparts != inparts_) { + g_free(inparts[0]); + g_free(inparts[1]); + } } g_strfreev(parts); } -- cgit v1.2.3