summaryrefslogtreecommitdiff
path: root/src/modes/cmode_k.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/modes/cmode_k.cpp')
-rw-r--r--src/modes/cmode_k.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/modes/cmode_k.cpp b/src/modes/cmode_k.cpp
index 6e5ba0269..751b993d3 100644
--- a/src/modes/cmode_k.cpp
+++ b/src/modes/cmode_k.cpp
@@ -39,9 +39,14 @@ ModeAction ModeChannelKey::OnModeChange(userrec* source, userrec* dest, chanrec*
else if ((!channel->modes[CM_KEY]) || ((adding) && (!IS_LOCAL(source))))
{
/* Key isnt currently set */
- strlcpy(channel->key,parameter.c_str(),32);
- channel->modes[CM_KEY] = adding;
- return MODEACTION_ALLOW;
+ if (parameter.length())
+ {
+ strlcpy(channel->key,parameter.c_str(),32);
+ channel->modes[CM_KEY] = adding;
+ return MODEACTION_ALLOW;
+ }
+ else
+ return MODEACTION_DENY;
}
else if (((channel->modes[CM_KEY]) && (!strcasecmp(parameter.c_str(),channel->key))) || ((!adding) && (!IS_LOCAL(source))))
{