summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorailin-nemui <ailin-nemui@users.noreply.github.com>2016-06-06 16:58:40 +0200
committerailin-nemui <ailin-nemui@users.noreply.github.com>2016-06-06 16:58:40 +0200
commitd6d74c0da981af22fb8cbfa68d3bdc5446c55155 (patch)
treecaa879e4a9a50384226b5983e86050fad8a87719 /src/core
parentf72608ba24454402df27477471223ce15cc2926e (diff)
downloadirssi-d6d74c0da981af22fb8cbfa68d3bdc5446c55155.zip
Do not crash on OPTCHAN when item has no server
May fix bugs.debian.org#826525
Diffstat (limited to 'src/core')
-rw-r--r--src/core/commands.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/core/commands.c b/src/core/commands.c
index 88d1208c..607baf77 100644
--- a/src/core/commands.c
+++ b/src/core/commands.c
@@ -666,7 +666,7 @@ get_optional_channel(WI_ITEM_REC *active_item, char **data, int require_name)
const char *ret;
char *tmp, *origtmp, *channel;
- if (active_item == NULL) {
+ if (active_item == NULL || active_item->server == NULL) {
/* no active channel in window, channel required */
return cmd_get_param(data);
}
@@ -674,11 +674,13 @@ get_optional_channel(WI_ITEM_REC *active_item, char **data, int require_name)
origtmp = tmp = g_strdup(*data);
channel = cmd_get_param(&tmp);
- if (g_strcmp0(channel, "*") == 0 && !require_name) {
+ if (g_strcmp0(channel, "*") == 0 && IS_CHANNEL(active_item) &&
+ !require_name) {
/* "*" means active channel */
cmd_get_param(data);
ret = window_item_get_target(active_item);
- } else if (!server_ischannel(active_item->server, channel)) {
+ } else if (IS_CHANNEL(active_item) &&
+ !server_ischannel(active_item->server, channel)) {
/* we don't have channel parameter - use active channel */
ret = window_item_get_target(active_item);
} else {