added an exception when trying to outdent too much
authorFabien Potencier <fabien.potencier@gmail.com>
Tue, 14 Dec 2010 11:54:32 +0000 (12:54 +0100)
committerFabien Potencier <fabien.potencier@gmail.com>
Tue, 14 Dec 2010 11:54:32 +0000 (12:54 +0100)
lib/Twig/Compiler.php

index 72d791d..7eb90d0 100644 (file)
@@ -218,6 +218,10 @@ class Twig_Compiler implements Twig_CompilerInterface
     {
         $this->indentation -= $step;
 
+        if ($this->indentation < 0) {
+            throw new Twig_Error('Unable to call outdent() as the indentation would become negative');
+        }
+
         return $this;
     }
 }