summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsefftinge2008-02-28 04:48:51 (EST)
committersefftinge2008-02-28 04:48:51 (EST)
commitc8f4dcf72fc88ab8dbfde7d43991044442537ba7 (patch)
tree9f9944a33042e51a157887d238dfdc2a09cf0644
parent59d3f2ba75fd01e73a414bfc2fe3fc399650e19f (diff)
downloadorg.eclipse.xpand-c8f4dcf72fc88ab8dbfde7d43991044442537ba7.zip
org.eclipse.xpand-c8f4dcf72fc88ab8dbfde7d43991044442537ba7.tar.gz
org.eclipse.xpand-c8f4dcf72fc88ab8dbfde7d43991044442537ba7.tar.bz2
Fixed NPE
-rw-r--r--plugins/org.eclipse.xpand3/src/org/eclipse/xpand3/parser/AbstractXpand3NodeParser.java12
1 files changed, 8 insertions, 4 deletions
diff --git a/plugins/org.eclipse.xpand3/src/org/eclipse/xpand3/parser/AbstractXpand3NodeParser.java b/plugins/org.eclipse.xpand3/src/org/eclipse/xpand3/parser/AbstractXpand3NodeParser.java
index 1ff4c0e..60e38d9 100644
--- a/plugins/org.eclipse.xpand3/src/org/eclipse/xpand3/parser/AbstractXpand3NodeParser.java
+++ b/plugins/org.eclipse.xpand3/src/org/eclipse/xpand3/parser/AbstractXpand3NodeParser.java
@@ -16,7 +16,7 @@ import org.eclipse.xpand3.node.NodeFactory;
public abstract class AbstractXpand3NodeParser extends Xpand3Parser {
private CompositeNode current = null;
- private CompositeNode rootNode = null;
+ private Node rootNode = null;
public AbstractXpand3NodeParser(TokenStream input) {
super(input);
@@ -49,9 +49,13 @@ public abstract class AbstractXpand3NodeParser extends Xpand3Parser {
&& current.getChildren().size() == 1
&& (current.getChildren().get(0) instanceof CompositeNode)) {
Node child = current.getChildren().get(0);
- int i = parent.getChildren().indexOf(current);
- parent.getChildren().remove(i);
- parent.getChildren().add(i, child);
+ if (parent != null) {
+ int i = parent.getChildren().indexOf(current);
+ parent.getChildren().remove(i);
+ parent.getChildren().add(i, child);
+ } else {
+ rootNode = child;
+ }
}
current = parent;
}