]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - lib/rbot/registry.rb
test
[user/henk/code/ruby/rbot.git] / lib / rbot / registry.rb
index 5228d22391fda663e6cf010b758fc6ea3c2607fc..2a7edbb6fc07bff163799936760cb9a423687fb4 100644 (file)
@@ -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