Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/codan
diff options
context:
space:
mode:
authorNathan Ridge2018-02-09 01:42:17 +0000
committerNathan Ridge2018-02-10 20:40:15 +0000
commit3171322555a920c80cc24eddb74fe37d567882ce (patch)
tree7b4a0206e9aa98784a47277aa53a5af01baf26fe /codan
parent5e27e4c377577bfa4535abd74fb9bcc5ad1696b2 (diff)
downloadorg.eclipse.cdt-3171322555a920c80cc24eddb74fe37d567882ce.tar.gz
org.eclipse.cdt-3171322555a920c80cc24eddb74fe37d567882ce.tar.xz
org.eclipse.cdt-3171322555a920c80cc24eddb74fe37d567882ce.zip
Bug 529383 - NPE in CheckersRegistry.getResourceProfile()
Diffstat (limited to 'codan')
-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