diff --git a/lib/Pinpoint/Plugins/LaravelPerRequest.php b/lib/Pinpoint/Plugins/LaravelPerRequest.php index b33282a..22b7611 100644 --- a/lib/Pinpoint/Plugins/LaravelPerRequest.php +++ b/lib/Pinpoint/Plugins/LaravelPerRequest.php @@ -21,8 +21,17 @@ class LaravelPerRequest extends DefaultRequestPlugin { public function __destruct() { - pinpoint_set_context(PP_ROUTE_KEY, Request()->route()->uri()); + $route = Request()->route(); + if ($route) { + pinpoint_set_context(PP_ROUTE_KEY, Request()->route()->uri()); + } else { + pinpoint_set_context(PP_ROUTE_KEY, "_none_"); + } parent::__destruct(); } } -//author: eeliu \ No newline at end of file +//author: eeliu + +// Changes +// 2024/9/02 +// fix "Request()->route()" can be none \ No newline at end of file