From e439b20618b269f72e3c86d8766530d269b376bb Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Fri, 17 Jul 2020 17:44:01 +0200 Subject: [PATCH] Fix crash if gift card does not exist --- src/pretix/base/payment.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pretix/base/payment.py b/src/pretix/base/payment.py index e709b570e..4e5e45d84 100644 --- a/src/pretix/base/payment.py +++ b/src/pretix/base/payment.py @@ -1062,7 +1062,10 @@ class GiftCardPayment(BasePaymentProvider): def api_payment_details(self, payment: OrderPayment): from .models import GiftCard - gc = GiftCard.objects.get(pk=payment.info_data.get('gift_card')) + try: + gc = GiftCard.objects.get(pk=payment.info_data.get('gift_card')) + except GiftCard.DoesNotExist: + return {} return { 'gift_card': { 'id': gc.pk,