diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/SemanticHighlightingTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/SemanticHighlightingTest.java index 482d09ebb11..85ac7c5a5fd 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/SemanticHighlightingTest.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/SemanticHighlightingTest.java @@ -426,4 +426,12 @@ public class SemanticHighlightingTest extends TestCase { public void testCStructureName_451772() throws Exception { makeAssertions(false /* parse as C file */); } + + // template //$templateParameter + // void foo(T t) { //$functionDeclaration,templateParameter,parameterVariable + // bar(t); //$function,parameterVariable + // } + public void testNPE_458317() throws Exception { + makeAssertions(); + } } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightings.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightings.java index f99ca12ef61..24bb7e67790 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightings.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightings.java @@ -486,9 +486,12 @@ public class SemanticHighlightings { if (binding instanceof ICPPMethod) { return true; } else if (binding instanceof ICPPDeferredFunction) { - for (ICPPFunction candidate : ((ICPPDeferredFunction) binding).getCandidates()) { - if (candidate instanceof ICPPMethod) { - return true; + ICPPFunction[] candidates = ((ICPPDeferredFunction) binding).getCandidates(); + if (candidates != null) { + for (ICPPFunction candidate : candidates) { + if (candidate instanceof ICPPMethod) { + return true; + } } } }