Makes sure we do not fail if encoding == nil

It looks like it's valid to call this method even if `binary?` is true.
Encoding as 'ASCII-8BIT' should always succeed.
This commit is contained in:
Andy Lindeman
2014-05-21 11:59:48 -04:00
parent 85efbde3f7
commit 185db0e8d5

View File

@@ -263,7 +263,7 @@ module Linguist
#
# Returns Integer
def sloc
lines.grep(Regexp.new('\S'.encode(encoding))).size
lines.grep(Regexp.new('\S'.encode(encoding || 'ASCII-8BIT'))).size
end
# Public: Is the blob a generated file?