1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-03 23:25:26 +02:00

Bug 529383 - NPE in CheckersRegistry.getResourceProfile()

Change-Id: I376cbf44c1fd237bd75a98ffc9e1daf60f5924ec
This commit is contained in:
Nathan Ridge 2018-02-08 20:42:17 -05:00
parent 276fda83a5
commit a8cf65fa75
2 changed files with 8 additions and 0 deletions

View file

@ -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);

View file

@ -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);