diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/commands.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/core/commands.c b/src/core/commands.c index 7893b1c1..928d73a0 100644 --- a/src/core/commands.c +++ b/src/core/commands.c @@ -313,7 +313,6 @@ void command_runsub(const char *cmd, const char *data, subcmd = g_strconcat("command ", newcmd, NULL); g_strdown(subcmd); - if (server != NULL) server_ref(server); if (!signal_emit(subcmd, 3, args, server, item)) { defcmd = g_strdup_printf("default command %s", cmd); if (!signal_emit(defcmd, 3, data, server, item)) { @@ -322,7 +321,6 @@ void command_runsub(const char *cmd, const char *data, } g_free(defcmd); } - if (server != NULL) server_unref(server); g_free(subcmd); g_free(orig); @@ -860,10 +858,12 @@ static void parse_command(const char *command, int expand_aliases, oldcmd = current_command; current_command = cmd+8; - if (!signal_emit(cmd, 3, args, server, item)) { + if (server != NULL) server_ref(server); + if (!signal_emit(cmd, 3, args, server, item)) { signal_emit_id(signal_default_command, 3, command, server, item); } + if (server != NULL) server_unref(server); current_command = oldcmd; g_free(cmd); |