summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/rbot/registry.rb15
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/rbot/registry.rb b/lib/rbot/registry.rb
index 5228d223..2a7edbb6 100644
--- a/lib/rbot/registry.rb
+++ b/lib/rbot/registry.rb
@@ -120,7 +120,20 @@ module Irc
# val
# end
def restore(val)
- Marshal.restore(val)
+ begin
+ Marshal.restore(val)
+ rescue
+ $stderr.puts "failed to restore marshal data, falling back to default"
+ if @default != nil
+ begin
+ return Marshal.restore(@default)
+ rescue
+ return nil
+ end
+ else
+ return nil
+ end
+ end
end
# lookup a key in the registry