From a9f480ca995196b32a863d6bf04560890d030d86 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sun, 28 Aug 2016 09:46:11 +0200 Subject: [PATCH] Fixed error while checking an API key that doesn't exist --- module/Rest/src/Action/AuthenticateAction.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/Rest/src/Action/AuthenticateAction.php b/module/Rest/src/Action/AuthenticateAction.php index 020a0fb5..a20e5964 100644 --- a/module/Rest/src/Action/AuthenticateAction.php +++ b/module/Rest/src/Action/AuthenticateAction.php @@ -66,7 +66,7 @@ class AuthenticateAction extends AbstractRestAction // Authenticate using provided API key $apiKey = $this->apiKeyService->getByKey($authData['apiKey']); - if (! $apiKey->isValid()) { + if (! isset($apiKey) || ! $apiKey->isValid()) { return new JsonResponse([ 'error' => RestUtils::INVALID_API_KEY_ERROR, 'message' => $this->translator->translate('Provided API key does not exist or is invalid.'),