From: Sean Chittenden Date: 2002-06-20T22:34:38+09:00 Subject: lib/pstore.rb patch... --RMedoP2+Pr6Rq0N2 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline This patch fixes the possibility of reading from a freshly created/truncated pstore file. Comments? -sc -- Sean Chittenden --RMedoP2+Pr6Rq0N2 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=patch Index: lib/pstore.rb =================================================================== RCS file: /src/ruby/lib/pstore.rb,v retrieving revision 1.13 diff -u -u -r1.13 pstore.rb --- lib/pstore.rb 2001/12/01 14:03:19 1.13 +++ lib/pstore.rb 2002/06/20 13:32:23 @@ -97,10 +97,14 @@ @table = Marshal::load(file) elsif orig content = file.read - @table = Marshal::load(content) - size = content.size - md5 = Digest::MD5.digest(content) - content = nil # unreference huge data + unless content.nil? + @table = Marshal::load(content) + size = content.size + md5 = Digest::MD5.digest(content) + content = nil # unreference huge data + else + @table = {} + end else @table = {} end --RMedoP2+Pr6Rq0N2--