diff --git a/Twig/SyliusResourceExtension.php b/Twig/SyliusResourceExtension.php
index <HASH>..<HASH> 100644
--- a/Twig/SyliusResourceExtension.php
+++ b/Twig/SyliusResourceExtension.php
@@ -63,7 +63,7 @@ class SyliusResourceExtension extends Twig_Extension
     {
         $label = null === $label ? $property : $label;
         $route = null === $route ? $this->request->attributes->get('_route') : $route;
-        $routeParameters = empty($routeParameters) ? $this->request->attributes->get('_route_parameters') : $routeParameters;
+        $routeParameters = empty($routeParameters) ? $this->request->attributes->get('_route_parameters', array()) : $routeParameters;
 
         $sorting = $this->request->get('sorting');
 
@@ -76,7 +76,7 @@ class SyliusResourceExtension extends Twig_Extension
         $order = null === $order ? 'asc' : $order;
 
         $url = $this->router->generate($route, array_merge(
-            array('sorting' => array($property => $order), $routeParameters)
+            array('sorting' => array($property => $order)), $routeParameters
         ));
 
         return sprintf('<a href="%s">%s</a>', $url, $label);
Fixed failed to build the route parameters in Twig extension