Permalink
Browse files

fix utf error for blobs on 1.9

  • Loading branch information...
1 parent 26a4770 commit 50c4cd501071518083e2472fe19adba64e371622 @grosser committed May 5, 2012
Showing with 5 additions and 1 deletion.
  1. +5 −1 lib/language_sniffer/blob_helper.rb
@@ -31,7 +31,11 @@ def extname
#
# Returns an Array of lines
def lines
- @lines ||= (data ? data.split("\n", -1) : [])
+ @lines ||= begin
+ (data ? data.split("\n", -1) : [])
+ rescue ArgumentError # invalid byte sequence in UTF-8
+ []
+ end
end
# Public: Get number of lines of code

0 comments on commit 50c4cd5

Please sign in to comment.