소스 검색

When route_attributes is null an exception is raised.

jeff 14 년 전
부모
커밋
52ec8752d8
1개의 변경된 파일9개의 추가작업 그리고 2개의 파일을 삭제
  1. 9 2
      src/Symfony/Bundle/TwigBundle/Node/RouteNode.php

+ 9 - 2
src/Symfony/Bundle/TwigBundle/Node/RouteNode.php

@@ -35,8 +35,15 @@ class RouteNode extends \Twig_Node
             ->write('echo $this->env->getExtension(\'templating\')->getContainer()->get(\'router\')->generate(')
             ->subcompile($this->getNode('route'))
             ->raw(', ')
-            ->subcompile($this->getNode('route_attributes'))
-            ->raw(', ')
+        ;
+
+        $attr = $this->getNode('route_attributes');
+        if ($attr) {
+            $compiler->subcompile($attr);
+        } else {
+            $compiler->raw('array()');
+        }
+        $compiler->raw(', ')
             ->raw($this->getAttribute('absolute') ? 'true' : 'false')
             ->raw(");")
         ;