Permalink
Browse files

Wrap md5sum in a try/catch

  • Loading branch information...
1 parent 4fd9590 commit 911c5cb03cea01c3673f321a5af2779ee227fb05 @paulcbetts committed Nov 23, 2007
Showing with 8 additions and 3 deletions.
  1. +8 −3 lib/library.rb
View
@@ -75,9 +75,14 @@ def load(files, progress_rate = 0.05)
# First, see if we've already scanned this file before (save some time
# and only read the first 256K)
- md5sum = Digest::MD5.hexdigest(File.open(current, 'r') {|x| x.read(0x40000)})
- if (@tag_info[current] = @md5_index[md5sum])
- #log DEBUG, "Cache hit!"
+ begin
+ md5sum = Digest::MD5.hexdigest(File.open(current, 'r') {|x| x.read(0x40000)})
+ if (@tag_info[current] = @md5_index[md5sum])
+ #log DEBUG, "Cache hit!"
+ next
+ end
+ rescue
+ @tag_info.delete current
next
end

0 comments on commit 911c5cb

Please sign in to comment.