From 5e158c3bd7ad65ec9b708a9620ef288f58466022 Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Thu, 19 Jul 2018 09:13:54 +0200 Subject: [PATCH] Prevent a KeyError with invalid add-on configuration --- src/pretix/control/forms/item.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pretix/control/forms/item.py b/src/pretix/control/forms/item.py index e6487f54e4..bf3fee8a40 100644 --- a/src/pretix/control/forms/item.py +++ b/src/pretix/control/forms/item.py @@ -411,7 +411,10 @@ class ItemAddOnsFormSet(I18nFormSet): if self._should_delete_form(form): # This form is going to be deleted so any of its errors # should not cause the entire formset to be invalid. - categories.remove(form.cleaned_data['addon_category'].pk) + try: + categories.remove(form.cleaned_data['addon_category'].pk) + except KeyError: + pass continue if form.cleaned_data['addon_category'].pk in categories: