From 5302e5cdb047ae0fc16e9229b2e310d2cbf68c5e Mon Sep 17 00:00:00 2001 From: Christoph Lehmann Date: Thu, 1 Apr 2021 23:25:55 +0200 Subject: [PATCH] [BUGFIX] Handle non-existent event in checkCancelRegistration() This prevents 'Call to a member function getEnableCancel() on null' --- Classes/Service/RegistrationService.php | 6 ++++++ Resources/Private/Language/locallang.xlf | 3 +++ 2 files changed, 9 insertions(+) diff --git a/Classes/Service/RegistrationService.php b/Classes/Service/RegistrationService.php index 02c6493bc..ff7c96c77 100644 --- a/Classes/Service/RegistrationService.php +++ b/Classes/Service/RegistrationService.php @@ -278,6 +278,12 @@ public function checkCancelRegistration($reguid, $hmac) $titleKey = 'cancelRegistration.title.failed'; } + if (!$failed && is_null($registration->getEvent())) { + $failed = true; + $messageKey = 'event.message.cancel_failed_event_not_found'; + $titleKey = 'cancelRegistration.title.failed'; + } + if (!$failed && $registration->getEvent()->getEnableCancel() === false) { $failed = true; $messageKey = 'event.message.confirmation_failed_cancel_disabled'; diff --git a/Resources/Private/Language/locallang.xlf b/Resources/Private/Language/locallang.xlf index 8c41d3c4b..ed3457ccf 100644 --- a/Resources/Private/Language/locallang.xlf +++ b/Resources/Private/Language/locallang.xlf @@ -234,6 +234,9 @@ Confirmation failed, registration not found. + + Cancellation failed, event not found. + Confirmation failed, confirmation date has expired.