summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Gilbert <tom@linuxbrit.co.uk>2005-12-12 15:44:30 +0000
committerTom Gilbert <tom@linuxbrit.co.uk>2005-12-12 15:44:30 +0000
commit48a1862ef7c85081a622e488665644bd2f6c16c3 (patch)
tree8ec9218c21ab8c93b0277821716759fa3d7ab7a1
parent7f42a18b2f582b29dcf204ace260d08e12e25869 (diff)
try to handle backwards compat issues
-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