diff --git a/plugins/Factoids/plugin.py b/plugins/Factoids/plugin.py index 71eb9704f..f86c937cd 100644 --- a/plugins/Factoids/plugin.py +++ b/plugins/Factoids/plugin.py @@ -1,6 +1,6 @@ ### # Copyright (c) 2002-2005, Jeremiah Fincher -# Copyright (c) 2009, James Vega +# Copyright (c) 2009-2010, James Vega # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -63,6 +63,8 @@ def getFactoid(irc, msg, args, state): key.append(args.pop(0)) else: value.append(args.pop(0)) + if not key or not value: + raise callbacks.ArgumentError state.args.append(' '.join(key)) state.args.append(' '.join(value)) diff --git a/plugins/Factoids/test.py b/plugins/Factoids/test.py index a2c1f4a1a..fb8fa7e35 100644 --- a/plugins/Factoids/test.py +++ b/plugins/Factoids/test.py @@ -1,5 +1,6 @@ ### # Copyright (c) 2002-2005, Jeremiah Fincher +# Copyright (c) 2010, James Vega # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -43,6 +44,8 @@ if sqlite: self.assertRegexp('random', 'primary author') def testLearn(self): + self.assertError('learn as my primary author') + self.assertError('learn jemfinch as') self.assertNotError('learn jemfinch as my primary author') self.assertNotError('info jemfinch') self.assertRegexp('whatis jemfinch', 'my primary author')