From 489ad87ad61da7dadcfc0f8e60a25330f792cbb6 Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Mon, 12 Sep 2022 12:41:17 +0200 Subject: [PATCH] Fix rare crash in cart ID creation (PRETIXEU-78E) --- src/pretix/presale/views/cart.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pretix/presale/views/cart.py b/src/pretix/presale/views/cart.py index 61bec628a7..9b67804e8d 100644 --- a/src/pretix/presale/views/cart.py +++ b/src/pretix/presale/views/cart.py @@ -353,7 +353,8 @@ def get_or_create_cart_id(request, create=True): if cart_invalidated: # This cart was created with a login but the person is now logged out. # Destroy the cart for privacy protection. - request.session['carts'][current_id] = {} + if 'carts' in request.session: + request.session['carts'][current_id] = {} else: return current_id