From 185db0e8d5553067e394a230fc6453728f55e795 Mon Sep 17 00:00:00 2001 From: Andy Lindeman Date: Wed, 21 May 2014 11:59:48 -0400 Subject: [PATCH] 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. --- lib/linguist/blob_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/linguist/blob_helper.rb b/lib/linguist/blob_helper.rb index 8aa96ed4..9ab8d2c5 100644 --- a/lib/linguist/blob_helper.rb +++ b/lib/linguist/blob_helper.rb @@ -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?