Fix crash if a custom error message is provided to somethingWithoutSpaces

Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
This commit is contained in:
James McCoy 2013-08-23 22:06:07 -04:00
parent c73ead8aef
commit e421722960

View File

@ -504,11 +504,12 @@ def getSomething(irc, msg, args, state, errorMsg=None, p=None):
else: else:
state.args.append(args.pop(0)) state.args.append(args.pop(0))
def getSomethingNoSpaces(irc, msg, args, state, *L): def getSomethingNoSpaces(irc, msg, args, state, errorMsg=None):
def p(s): def p(s):
return len(s.split(None, 1)) == 1 return len(s.split(None, 1)) == 1
errmsg = 'You must not give a string containing spaces as an argument.' if errorMsg is None:
getSomething(irc, msg, args, state, p=p, errorMsg=errmsg, *L) errorMsg='You must not give a string containing spaces as an argument.'
getSomething(irc, msg, args, state, errorMsg=errorMsg, p=p)
def private(irc, msg, args, state): def private(irc, msg, args, state):
if irc.isChannel(msg.args[0]): if irc.isChannel(msg.args[0]):