From b4460e59fa59c8e08ec65dd7af67a2d9103f771a Mon Sep 17 00:00:00 2001 From: Philippe PITTOLI Date: Tue, 7 May 2024 01:34:15 +0200 Subject: [PATCH] For cached databases: clone the requested value to avoid problems. --- src/cached.cr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cached.cr b/src/cached.cr index a9617ac..8c46656 100644 --- a/src/cached.cr +++ b/src/cached.cr @@ -45,7 +45,7 @@ class DODB::CachedDataBase(V) < DODB::Storage(V) return nil end def [](key : Int32) : V - @data[key] rescue raise MissingEntry.new(key) + @data[key].clone rescue raise MissingEntry.new(key) end def []=(index : Int32, value : V)