diff options
author | Renato "Lond" Cerqueira <renato@lond.com.br> | 2019-01-14 17:28:41 +0100 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2019-01-14 17:28:41 +0100 |
commit | 5c5e14c816eb0871344bb69a96bc4bb38e0d3061 (patch) | |
tree | ccb3b71f7c2c570530938f61ee375f7414b36592 /app/services | |
parent | b4e6384aeafc9011707aa27d4948aaa9ca907db3 (diff) |
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
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/fetch_oembed_service.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/app/services/fetch_oembed_service.rb b/app/services/fetch_oembed_service.rb index 9ddf9b13b..10176cfb9 100644 --- a/app/services/fetch_oembed_service.rb +++ b/app/services/fetch_oembed_service.rb @@ -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 |