Permalink
Browse files

don't read from empty cache files

  • Loading branch information...
1 parent e2794cb commit 6980af51e98a734feef3a3ad74eb3595648d0c4a @moritz committed Jun 22, 2011
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/WebService/Libris/FileCache.pm
@@ -20,7 +20,9 @@ sub get {
my ($self, $key) = @_;
my $filename = $self->_filename($key);
return unless open my $h, '<', $filename;
- Mojo::DOM->new(xml => 1, charset => 'UTF-8')->parse(do { local $/; <$h> });
+ my $contents = do { local $/; <$h> };
+ return unless length $contents;
+ Mojo::DOM->new(xml => 1, charset => 'UTF-8')->parse($contents);
}
sub set {

0 comments on commit 6980af5

Please sign in to comment.