diff --git a/src/DI/ApiRouterExtension.php b/src/DI/ApiRouterExtension.php
index <HASH>..<HASH> 100644
--- a/src/DI/ApiRouterExtension.php
+++ b/src/DI/ApiRouterExtension.php
@@ -129,7 +129,7 @@ class ApiRouterExtension extends CompilerExtension
 		/**
 		 * Add route to priority-half-sorted list
 		 */
-		if (!$routes[$route->getPriority()]) {
+		if ($routes !== [] && !$routes[$route->getPriority()]) {
 			$routes[$route->getPriority()] = [];
 		}
fixed compatibility with Nette <I> (#<I>)