Fix undefined method error in sidekiq (#9807)
* Fix undefined method error in sidekiq Body can be not nil but still be empty, which causes a `NoMethodError: undefined method `[]' for nil:NilClass` further in the code. This checks for an empty body to avoid the issue. * Fix codeclimate issue
This commit is contained in:
parent
b4e6384aea
commit
5c5e14c816
3 changed files with 26 additions and 1 deletions
|
@ -43,7 +43,7 @@ class FetchOEmbedService
|
|||
res.code != 200 ? nil : res.body_with_limit
|
||||
end
|
||||
|
||||
validate(parse_for_format(body)) unless body.nil?
|
||||
validate(parse_for_format(body)) if body.present?
|
||||
rescue Oj::ParseError, Ox::ParseError
|
||||
nil
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue