From f02f2c540c9bd598e93469b98ef3dfa9ff981e9d Mon Sep 17 00:00:00 2001 From: Arun Kumar Mohan Date: Fri, 11 Dec 2020 20:01:41 -0500 Subject: [PATCH] Handle nil stripe customer in credit card clone removal logic --- lib/stripe/credit_card_clone_destroyer.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/stripe/credit_card_clone_destroyer.rb b/lib/stripe/credit_card_clone_destroyer.rb index 6fa3db9a88..178d8aa657 100644 --- a/lib/stripe/credit_card_clone_destroyer.rb +++ b/lib/stripe/credit_card_clone_destroyer.rb @@ -16,8 +16,8 @@ module Stripe Stripe::CreditCardCloneFinder.new(card, stripe_account).find_cloned_card next unless customer_id - customer = Stripe::Customer.retrieve(customer_id, stripe_account: stripe_account) - customer&.delete unless customer.deleted? + stripe_customer = Stripe::Customer.retrieve(customer_id, stripe_account: stripe_account) + stripe_customer.delete if stripe_customer && !stripe_customer.deleted? end end end