markup-validator commit: Avoid error log trashing from BOM lookup on empty documents.

changeset:   3195:d933a252d9bc
tag:         tip
user:        Ville Skyttä <ville.skytta@iki.fi>
date:        Wed Dec 15 00:15:52 2010 +0200
files:       httpd/cgi-bin/check
description:
Avoid error log trashing from BOM lookup on empty documents.


diff -r c1b3289341f5 -r d933a252d9bc httpd/cgi-bin/check
--- a/httpd/cgi-bin/check	Wed Dec 15 00:05:28 2010 +0200
+++ b/httpd/cgi-bin/check	Wed Dec 15 00:15:52 2010 +0200
@@ -558,7 +558,7 @@
 
 #
 # Add a warning if doc is UTF-8 and contains a BOM.
-if ($File->{Charset}->{Use} eq 'utf-8' &&
+if ($File->{Charset}->{Use} eq 'utf-8' && @{$File->{Content}} &&
     $File->{Content}->[0] =~ m(^\x{FEFF}))
 {
     &add_warning('W21', {});

Received on Tuesday, 14 December 2010 22:15:59 UTC