diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/http_observer/stream_loader.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/http_observer/stream_loader.js b/lib/http_observer/stream_loader.js index a90e341..09b4a63 100644 --- a/lib/http_observer/stream_loader.js +++ b/lib/http_observer/stream_loader.js @@ -140,7 +140,9 @@ StreamListener.prototype.onDetermineCharset = function onDetermineCharset( return loader.channel.contentCharset; } else { match = getRegexForContentType(loader.channel.contentType).exec(data); - if (match.length > 0 && + if (typeof match !== 'undefined' && + match !== null && + match.length > 0 && CHARSETS.indexOf(match[1].toLowerCase()) >= 0 ) { loader.channel.contentCharset = match[1]; |