From 31046f789a6593370a72159fb7403da11a365b73 Mon Sep 17 00:00:00 2001 From: Tobias Nyholm Date: Wed, 1 Feb 2017 18:35:49 +0100 Subject: [PATCH] Make sure we have a data collector --- Controller/SymfonyProfilerController.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Controller/SymfonyProfilerController.php b/Controller/SymfonyProfilerController.php index af27dbbd..7e7fad22 100644 --- a/Controller/SymfonyProfilerController.php +++ b/Controller/SymfonyProfilerController.php @@ -149,7 +149,11 @@ private function getMessage(Request $request, $token) $messageId = $request->request->get('message_id', $request->query->get('message_id')); $profile = $profiler->loadProfile($token); - $messages = $profile->getCollector('translation')->getMessages(); + if (null === $dataCollector = $profile->getCollector('translation')) { + throw $this->createNotFoundException('No collector with name "translation" was found.'); + } + + $messages = $dataCollector->getMessages(); if (!isset($messages[$messageId])) { throw $this->createNotFoundException(sprintf('No message with key "%s" was found.', $messageId)); }