diff --git a/lib/private/route/router.php b/lib/private/route/router.php
index 03bee3d20373f3a1fdee6df93551919df17c63ba..ef02b5aba0e8c6572c10e06a02405aa4a8821b74 100644
--- a/lib/private/route/router.php
+++ b/lib/private/route/router.php
@@ -95,9 +95,12 @@ class Router implements IRouter {
 		if (!isset($this->routingFiles)) {
 			$this->routingFiles = [];
 			foreach (\OC_APP::getEnabledApps() as $app) {
-				$file = \OC_App::getAppPath($app) . '/appinfo/routes.php';
-				if (file_exists($file)) {
-					$this->routingFiles[$app] = $file;
+				$appPath = \OC_App::getAppPath($app);
+				if($appPath !== false) {
+					$file = $appPath . '/appinfo/routes.php';
+					if (file_exists($file)) {
+						$this->routingFiles[$app] = $file;
+					}
 				}
 			}
 		}