Skip to content

Commit 4d50997

Browse files
authored
fix: added fallback to null when route paths are not available (#18)
1 parent ea36fb4 commit 4d50997

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/TreblleEventSubscriber.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,13 @@ public function onKernelTerminate(KernelEvent $event): void
105105
throw TreblleException::missingProjectId();
106106
}
107107

108-
$routePath = $this->router->getRouteCollection()->get($this->request->attributes->get('_route'))->getPath();
108+
$routePath = null;
109+
$route = $this->request->attributes->get('_route');
110+
111+
if (is_string($route)) {
112+
$routePath = $this->router->getRouteCollection()->get($this->request->attributes->get('_route'))?->getPath();
113+
}
114+
109115
$requestProvider = new SymfonyRequestDataProvider($this->configuration, $this->request, $routePath);
110116
$responseProvider = new SymfonyResponseDataProvider($this->configuration, $this->request, $this->response, $this->errorDataProvider);
111117

0 commit comments

Comments
 (0)