summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Ridge2018-09-01 23:58:17 -0400
committerNathan Ridge2018-09-15 19:42:08 -0400
commit4549e7f39a787a75f7ec4119524d120bcac1eeec (patch)
tree549c1aeb151cb3d384030072a3d0d0789eae7b7e
parenta8a29d195a71321a76fa6e645411b663e3fede02 (diff)
downloadorg.eclipse.cdt-4549e7f39a787a75f7ec4119524d120bcac1eeec.tar.gz
org.eclipse.cdt-4549e7f39a787a75f7ec4119524d120bcac1eeec.tar.xz
org.eclipse.cdt-4549e7f39a787a75f7ec4119524d120bcac1eeec.zip
Bug 538266 - NPE in QuickFixCreateNewClass.isApplicable()
-rw-r--r--codan/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/internal/checkers/ui/quickfix/QuickFixCreateNewClass.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/codan/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/internal/checkers/ui/quickfix/QuickFixCreateNewClass.java b/codan/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/internal/checkers/ui/quickfix/QuickFixCreateNewClass.java
index 605484d03d..f5d836711f 100644
--- a/codan/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/internal/checkers/ui/quickfix/QuickFixCreateNewClass.java
+++ b/codan/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/internal/checkers/ui/quickfix/QuickFixCreateNewClass.java
@@ -20,6 +20,7 @@ import org.eclipse.cdt.codan.internal.checkers.ui.CheckersUiActivator;
import org.eclipse.cdt.codan.ui.AbstractCodanCMarkerResolution;
import org.eclipse.cdt.core.dom.ILinkage;
import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.ILanguage;
import org.eclipse.cdt.core.model.ITranslationUnit;
import org.eclipse.cdt.internal.corext.util.CModelUtil;
import org.eclipse.cdt.internal.ui.wizards.NewClassCreationWizard;
@@ -67,7 +68,8 @@ public class QuickFixCreateNewClass extends AbstractCodanCMarkerResolution imple
public boolean isApplicable(IMarker marker) {
return getTranslationUnitViaEditorOrWorkspace(marker).map(tu -> {
try {
- return tu.getLanguage().getLinkageID() != ILinkage.C_LINKAGE_ID;
+ ILanguage language = tu.getLanguage();
+ return language != null && language.getLinkageID() != ILinkage.C_LINKAGE_ID;
} catch (CoreException e) {
return true;
}