mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Guard against classify nil data
This commit is contained in:
@@ -97,6 +97,7 @@ module Linguist
|
||||
# Returns sorted Array of result pairs. Each pair contains the
|
||||
# Language and a Float score.
|
||||
def classify(tokens, languages = @languages.keys)
|
||||
return [] if tokens.nil?
|
||||
tokens = Tokenizer.new(tokens).tokens if tokens.is_a?(String)
|
||||
|
||||
scores = {}
|
||||
|
||||
Reference in New Issue
Block a user