Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Ridge2015-01-24 10:23:26 +0000
committerSergey Prigogin2015-01-24 21:51:57 +0000
commit6fc37b10e7798e15bd57ac68bc3dc1787fb0b6df (patch)
tree998020ee684e1b2e8b9fa1a98b8276dc1ff3e17a
parent796991a0e4dca0652a2ae9ef997c9d825d04ba09 (diff)
downloadorg.eclipse.cdt-6fc37b10e7798e15bd57ac68bc3dc1787fb0b6df.tar.gz
org.eclipse.cdt-6fc37b10e7798e15bd57ac68bc3dc1787fb0b6df.tar.xz
org.eclipse.cdt-6fc37b10e7798e15bd57ac68bc3dc1787fb0b6df.zip
Bug 458317 - Fix an NPE in MethodHighlighting.consumes()
Change-Id: I6a88e26aa60d57dd8c95079672ce0c1ceff8b3d7 Signed-off-by: Nathan Ridge <zeratul976@hotmail.com>
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/SemanticHighlightingTest.java8
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightings.java9
2 files changed, 14 insertions, 3 deletions
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 <typename T> //$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;
+ }
}
}
}

Back to the top