Protect against an NPE.
authorSergey Prigogin <eclipse.sprigogin@gmail.com>
Thu, 4 Jun 2015 01:18:57 +0000 (18:18 -0700)
committerSergey Prigogin <eclipse.sprigogin@gmail.com>
Thu, 4 Jun 2015 01:18:57 +0000 (18:18 -0700)
core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPFunctionSet.java
core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalFunctionSet.java

index 8b8ec43..23c0095 100644 (file)
@@ -80,6 +80,10 @@ public class CPPFunctionSet implements ICPPTwoPhaseBinding {
                return null;
        }
 
+       /**
+        * Returns the template arguments, or {@code null} if the function set doesn't represent a template
+        * specialization.
+        */
        public ICPPTemplateArgument[] getTemplateArguments() {
                return fTemplateArguments;
        }
index 5625f2e..bae7071 100644 (file)
@@ -332,8 +332,10 @@ public class EvalFunctionSet extends CPPDependentEvaluation {
                int r = CPPTemplates.PACK_SIZE_NOT_FOUND;
                if (fFunctionSet != null) {
                        ICPPTemplateArgument[] templateArguments = fFunctionSet.getTemplateArguments();
-                       for (ICPPTemplateArgument arg : templateArguments) {
-                               r = CPPTemplates.combinePackSize(r, CPPTemplates.determinePackSize(arg, tpMap));
+                       if (templateArguments != null) {
+                               for (ICPPTemplateArgument arg : templateArguments) {
+                                       r = CPPTemplates.combinePackSize(r, CPPTemplates.determinePackSize(arg, tpMap));
+                               }
                        }
                }
                return r;