diff --git a/src/Menu/Page/Renderer/HtmlTree.php b/src/Menu/Page/Renderer/HtmlTree.php
index 8a3d27f0..f0c0128d 100644
--- a/src/Menu/Page/Renderer/HtmlTree.php
+++ b/src/Menu/Page/Renderer/HtmlTree.php
@@ -132,12 +132,15 @@ private function getTemplate($key)
*/
private function addCssClasses($beginCurrent, $route)
{
+ $menuItem = $this->getMenuItem();
$cssClasses = [];
- if($route == $this->getMenuItem()->route) {
+ if($route == $menuItem->route) {
$cssClasses[] = 'current';
}
- if(strpos($route, $this->getMenuItem()->route) === 0) {
- $cssClasses[] = 'active';
+ if(!empty($menuItem->route)) {
+ if(strpos($route, $menuItem->route) === 0) {
+ $cssClasses[] = 'active';
+ }
}
if(!empty($cssClasses)) {
$classString = sprintf(' class="%s"', implode(' ', $cssClasses));