Bug #1248155: avoid NPE in parser
authoraxelcl <axelcl>
Sun, 21 Aug 2005 11:57:24 +0000 (11:57 +0000)
committeraxelcl <axelcl>
Sun, 21 Aug 2005 11:57:24 +0000 (11:57 +0000)
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Parser.java

index a048341..459987a 100644 (file)
@@ -1803,7 +1803,7 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
                                new_elseif_list(iState);
                        } finally {
                                HashSet set = removeIfVariableSet();
-                               if (assignedVariableSet != null) {
+                               if (assignedVariableSet != null && set != null) {
                                        assignedVariableSet.addAll(set);
                                }
                        }
@@ -1816,7 +1816,9 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
                        if (assignedVariableSet != null) {
                                HashSet topSet = peekVariableSet();
                                if (topSet != null) {
-                                       topSet.addAll(set);
+                                       if (set != null) {
+                                               topSet.addAll(set);
+                                       }
                                        topSet.addAll(assignedVariableSet);
                                }
                        }
@@ -1852,7 +1854,7 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
                                elseif_list(iState);
                        } finally {
                                HashSet set = removeIfVariableSet();
-                               if (assignedVariableSet != null) {
+                               if (assignedVariableSet != null && set != null) {
                                        assignedVariableSet.addAll(set);
                                }
                        }
@@ -1865,7 +1867,9 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
                        if (assignedVariableSet != null) {
                                HashSet topSet = peekVariableSet();
                                if (topSet != null) {
-                                       topSet.addAll(set);
+                                       if (set != null) {
+                                               topSet.addAll(set);
+                                       }
                                        topSet.addAll(assignedVariableSet);
                                }
                        }