fixed toXml() method when some nodes are null
authorFabien Potencier <fabien.potencier@gmail.com>
Wed, 9 Jun 2010 14:03:58 +0000 (16:03 +0200)
committerFabien Potencier <fabien.potencier@gmail.com>
Wed, 9 Jun 2010 14:03:58 +0000 (16:03 +0200)
lib/Twig/Node.php

index 9fc162d..488918d 100644 (file)
@@ -79,6 +79,10 @@ class Twig_Node implements Twig_NodeInterface, ArrayAccess, Countable, Iterator
         }
 
         foreach ($this->nodes as $name => $n) {
+            if (null === $n) {
+                continue;
+            }
+
             $child = $n->toXml(true)->getElementsByTagName('node')->item(0);
             $child = $dom->importNode($child, true);
             $child->setAttribute('name', $name);