Skip to content

Commit

Permalink
Waiting list: Fix crash with invalid subevent id
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelm committed Dec 21, 2023
1 parent 4a49519 commit 092b51f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/pretix/presale/views/waiting.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from django.conf import settings
from django.contrib import messages
from django.db import transaction
from django.http import Http404
from django.shortcuts import get_object_or_404, redirect, render
from django.utils.decorators import method_decorator
from django.utils.timezone import now
Expand Down Expand Up @@ -107,8 +108,11 @@ def dispatch(self, request, *args, **kwargs):
self.subevent = None
if request.event.has_subevents:
if 'subevent' in request.GET:
self.subevent = get_object_or_404(SubEvent, event=request.event, pk=request.GET['subevent'],
active=True)
try:
self.subevent = get_object_or_404(SubEvent, event=request.event, pk=request.GET['subevent'],
active=True)
except ValueError:
raise Http404()
else:
messages.error(request, pgettext_lazy('subevent', "You need to select a date."))
return redirect(self.get_index_url())
Expand Down

0 comments on commit 092b51f

Please sign in to comment.