Skip to content

Commit

Permalink
Use try instead of safe navigation operator on possible undefined att…
Browse files Browse the repository at this point in the history
…ribute

Since the safe navigation operator does raise on undefined methods we should use try instead.
  • Loading branch information
Oldharlem committed Aug 8, 2021
1 parent cdd9198 commit 702a498
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/spree/user_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ def self.prepended(base)
end

def ensure_mollie_customer
return if mollie_customer_id&.present?
return if try(:mollie_customer_id).present?

# Don't create Mollie customers if spree_auth_devise is not installed.
return unless defined? Spree::User
Expand Down

0 comments on commit 702a498

Please sign in to comment.