diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-09-21 15:35:13 +0000 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-09-21 15:35:13 +0000 |
commit | 5241be5d7aad06247f0e101a153a279b0bb11aa8 (patch) | |
tree | ed31086c0048b8555bd55783f18d1a1636b7ea22 /lib | |
parent | d9899b3d78d19ce9189f134ab9104374c007657f (diff) |
New Auth Framework: auth core botmodule was failing when someone asked something about a nonexisting botuser
Diffstat (limited to 'lib')
-rw-r--r-- | lib/rbot/core/auth.rb | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/rbot/core/auth.rb b/lib/rbot/core/auth.rb index 59bcd54a..f32dad1c 100644 --- a/lib/rbot/core/auth.rb +++ b/lib/rbot/core/auth.rb @@ -343,10 +343,12 @@ class AuthModule < CoreBotModule butarget = botuser
has_for = splits[-2] == "for"
- butarget = @bot.auth.get_botuser(splits[-1]) if has_for
- return m.reply(_("you can't mess with %{user}") % {:user => butarget.username}) \
- if butarget == @bot.auth.botowner && botuser != butarget
- splits.slice!(-2,2) if has_for
+ if has_for
+ butarget = @bot.auth.get_botuser(splits[-1]) rescue nil
+ return m.reply(_("no such bot user %{user}") % {:user => splits[-1]}) unless butarget
+ splits.slice!(-2,2)
+ end
+ return m.reply(_("you can't mess with %{user}") % {:user => butarget.username}) if butarget == @bot.auth.botowner && botuser != butarget
bools = [:autologin, :"login-by-mask"]
can_set = [:password]
|