a bugfix on variables
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / ast / HTMLBlock.java
index 27d93fa..496ca72 100644 (file)
@@ -11,7 +11,7 @@ public class HTMLBlock extends Statement {
   public AstNode[] nodes;
 
   public HTMLBlock(final AstNode[] nodes) {
-    super(nodes[0].sourceStart, nodes[nodes.length-1].sourceEnd);
+    super(nodes[0].sourceStart, nodes[(nodes.length > 0) ? nodes.length - 1 : 0].sourceEnd);
     this.nodes = nodes;
   }
 
@@ -24,7 +24,7 @@ public class HTMLBlock extends Statement {
     final StringBuffer buff = new StringBuffer(tabString(tab));
     buff.append("?>");
     for (int i = 0; i < nodes.length; i++) {
-      buff.append(nodes[i].toString(tab +1));
+      buff.append(nodes[i].toString(tab + 1));
     }
     buff.append("<?php\n");
     return buff.toString();