mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
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:
@@ -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?
|
||||
|
||||
Reference in New Issue
Block a user