FIX: Skip gsub for normalizing whitespaces when text is nil (#6631)

This commit is contained in:
Rishabh
2018-11-20 13:42:32 +05:30
committed by Régis Hanol
parent bc41057949
commit eacbe28f55
2 changed files with 2 additions and 1 deletions

View File

@@ -57,7 +57,7 @@ class TextCleaner
@@whitespaces_regexp = Regexp.new("(\u00A0|\u1680|\u180E|[\u2000-\u200A]|\u2028|\u2029|\u202F|\u205F|\u3000)", "u").freeze
def self.normalize_whitespaces(text)
text.gsub(@@whitespaces_regexp, ' ')
text&.gsub(@@whitespaces_regexp, ' ')
end
end