diff --git a/lib/Subtitle/BASE.pm b/lib/Subtitle/BASE.pm index 7d90342..3e65e50 100644 --- a/lib/Subtitle/BASE.pm +++ b/lib/Subtitle/BASE.pm @@ -37,6 +37,8 @@ sub from_file { or return -1; my @lines = <$FH>; close $FH; + return unless @lines; # empty file? + $lines[0] =~ s[^\x{EF}\x{BB}\x{BF}][]; # strip BOM return $self->parse(\@lines); }