summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYaohan Chen <yaohan.chen@gmail.com>2007-08-14 18:02:04 +0000
committerYaohan Chen <yaohan.chen@gmail.com>2007-08-14 18:02:04 +0000
commitb57fac60a7b4904e5080ad9339d356133f14b903 (patch)
treead7245f6ce729d593575f198e1155080aac6d5ea
parent1c06426e4a8fbd9655322627a57a3fb8d6fff798 (diff)
* fixed incorrect loading logic which could have added entries to @aliases even when they
were invalid
-rw-r--r--data/rbot/plugins/alias.rb17
1 files changed, 9 insertions, 8 deletions
diff --git a/data/rbot/plugins/alias.rb b/data/rbot/plugins/alias.rb
index 581cde1f..1496755d 100644
--- a/data/rbot/plugins/alias.rb
+++ b/data/rbot/plugins/alias.rb
@@ -44,15 +44,16 @@ class AliasPlugin < Plugin
@data_file = "#{@data_path}/aliases.yaml"
# hash of alias => command entries
data = nil
- @aliases = if File.exist?(@data_file) &&
- (data = YAML.load_file(@data_file)) &&
- data.respond_to?(:each_pair)
- data
- else
- warning _("Data file is not found or corrupt, reinitializing data")
- Hash.new
+ aliases = if File.exist?(@data_file) &&
+ (data = YAML.load_file(@data_file)) &&
+ data.respond_to?(:each_pair)
+ data
+ else
+ warning _("Data file is not found or corrupt, reinitializing data")
+ Hash.new
end
- @aliases.each_pair do |a, c|
+ @aliases = Hash.new
+ aliases.each_pair do |a, c|
begin
add_alias(a, c)
rescue AliasDefinitionError