Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Ridge2018-02-09 01:42:17 +0000
committerNathan Ridge2018-02-12 00:12:59 +0000
commita8cf65fa75e32249bb753f44a058da024e8af6ee (patch)
tree3614912dbf49afc5da185ea2a594571569eb4ed2
parent276fda83a5d72c6283547708a2707049bfc8e647 (diff)
downloadorg.eclipse.cdt-a8cf65fa75e32249bb753f44a058da024e8af6ee.tar.gz
org.eclipse.cdt-a8cf65fa75e32249bb753f44a058da024e8af6ee.tar.xz
org.eclipse.cdt-a8cf65fa75e32249bb753f44a058da024e8af6ee.zip
Bug 529383 - NPE in CheckersRegistry.getResourceProfile()
-rw-r--r--codan/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/internal/checkers/ui/quickfix/CaseBreakQuickFixFallthroughAttribute.java3
-rw-r--r--codan/org.eclipse.cdt.codan.ui.cxx/src/org/eclipse/cdt/codan/ui/AbstractCodanCMarkerResolution.java5
2 files changed, 8 insertions, 0 deletions
diff --git a/codan/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/internal/checkers/ui/quickfix/CaseBreakQuickFixFallthroughAttribute.java b/codan/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/internal/checkers/ui/quickfix/CaseBreakQuickFixFallthroughAttribute.java
index f72294bfc8..1642ae0b96 100644
--- a/codan/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/internal/checkers/ui/quickfix/CaseBreakQuickFixFallthroughAttribute.java
+++ b/codan/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/internal/checkers/ui/quickfix/CaseBreakQuickFixFallthroughAttribute.java
@@ -29,6 +29,9 @@ public class CaseBreakQuickFixFallthroughAttribute extends AbstractCaseBreakQuic
@Override
public boolean isApplicable(IMarker marker) {
IProblem problem = getProblem(marker);
+ if (problem == null) {
+ return false;
+ }
RootProblemPreference map = (RootProblemPreference) problem.getPreference();
boolean enabled = (boolean) map.getChildValue(CaseBreakChecker.PARAM_ENABLE_FALLTHROUGH_QUICKFIX);
boolean last_case_enabled = (boolean) map.getChildValue(CaseBreakChecker.PARAM_LAST_CASE);
diff --git a/codan/org.eclipse.cdt.codan.ui.cxx/src/org/eclipse/cdt/codan/ui/AbstractCodanCMarkerResolution.java b/codan/org.eclipse.cdt.codan.ui.cxx/src/org/eclipse/cdt/codan/ui/AbstractCodanCMarkerResolution.java
index 430cd68f7b..50c8eca391 100644
--- a/codan/org.eclipse.cdt.codan.ui.cxx/src/org/eclipse/cdt/codan/ui/AbstractCodanCMarkerResolution.java
+++ b/codan/org.eclipse.cdt.codan.ui.cxx/src/org/eclipse/cdt/codan/ui/AbstractCodanCMarkerResolution.java
@@ -275,6 +275,11 @@ public abstract class AbstractCodanCMarkerResolution implements ICodanMarkerReso
public IProblem getProblem(IMarker marker) {
IResource resource = marker.getResource();
+ if (resource == null) {
+ // IMarker.getResource() is not supposed to return null,
+ // but it looks like it sometimes does (bug 529383).
+ return null;
+ }
IProblemProfile profile = CodanRuntime.getInstance().getCheckersRegistry().getResourceProfile(resource);
String id = getProblemId(marker);
return profile.findProblem(id);

Back to the top