about summary refs log tree commit diff
diff options
context:
space:
mode:
authorabcang <abcang1015@gmail.com>2018-02-04 20:32:41 +0900
committerEugen Rochko <eugen@zeonfederated.com>2018-02-04 12:32:41 +0100
commit9b6223f5e26ed53f285a95921e9c660e831a7f6d (patch)
tree269db20d804d4272a869055fe2c88a78d6b2adc0
parent3f35d4322266ee6f1bfab73a1161af2b0848573a (diff)
Validation of count works even when text of status is nil (#6429)
-rw-r--r--app/validators/status_length_validator.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/app/validators/status_length_validator.rb b/app/validators/status_length_validator.rb
index 77be3f1f5..ed5563f64 100644
--- a/app/validators/status_length_validator.rb
+++ b/app/validators/status_length_validator.rb
@@ -23,6 +23,8 @@ class StatusLengthValidator < ActiveModel::Validator
   end
 
   def countable_text(status)
+    return '' if status.text.nil?
+
     status.text.dup.tap do |new_text|
       new_text.gsub!(FetchLinkCardService::URL_PATTERN, 'x' * 23)
       new_text.gsub!(Account::MENTION_RE, '@\2')