Skip to content

Commit b05aaa6

Browse files
authored
Make sure we have a data collector (#77)
1 parent aeda72c commit b05aaa6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Controller/SymfonyProfilerController.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,11 @@ private function getMessage(Request $request, $token)
149149
$messageId = $request->request->get('message_id', $request->query->get('message_id'));
150150

151151
$profile = $profiler->loadProfile($token);
152-
$messages = $profile->getCollector('translation')->getMessages();
152+
if (null === $dataCollector = $profile->getCollector('translation')) {
153+
throw $this->createNotFoundException('No collector with name "translation" was found.');
154+
}
155+
156+
$messages = $dataCollector->getMessages();
153157
if (!isset($messages[$messageId])) {
154158
throw $this->createNotFoundException(sprintf('No message with key "%s" was found.', $messageId));
155159
}

0 commit comments

Comments
 (0)