From c391125e75fe205056da8e7e0d31e988be37199a Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Sun, 24 May 2009 13:49:38 +0200 Subject: [PATCH] seen plugin: check if there's a previous action before using it If the registry data is not an Array, there will be no 'before' information stored, so just use the normal output. --- data/rbot/plugins/seen.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/data/rbot/plugins/seen.rb b/data/rbot/plugins/seen.rb index babf7484..0fc6f076 100644 --- a/data/rbot/plugins/seen.rb +++ b/data/rbot/plugins/seen.rb @@ -81,14 +81,16 @@ class SeenPlugin < Plugin reg.last end - before = reg.first + if reg.kind_of? Array + before = reg.first + end formats = { :normal => _("%{nick} was last seen %{when}, %{doing}"), :with_before => _("%{nick} was last seen %{when}, %{doing} and %{time} before %{did_before}") } - if [:PART, :QUIT].include?(saw.type.to_sym) && + if before && [:PART, :QUIT].include?(saw.type.to_sym) && [:PUBLIC, :ACTION].include?(before.type.to_sym) did_before = case before.type.to_sym when :PUBLIC -- 2.39.5