From 00b30bb03a9af2543754bf5537bd0e890cb7d9ae Mon Sep 17 00:00:00 2001 From: Marc-Andre Laperle Date: Sun, 19 Feb 2017 21:50:01 -0500 Subject: [PATCH] Bug 512096 - Fix NPE selecting an LLVM toolchain in toolchain editor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When a toolchain is selected along with its builder, the builder gets matched to a “real builder” (ManagedBuildManager.getRealBuilder). If the builder is abstract, the builder is not in the possible list of matches, as implemented in Builder.getMatchKey. This causes getCurrentBuilderCompatibilityInfo to return null which is not handled. This patch changes the base LLVM builder to a non-abstract one, which solves this specific NPE. Also, in order to be more helpful to the user in case it happens to another toolchain, a null check was added with an error message that the builder is incompatible. Then at least, it is more clear that something is wrong and the user can pick a different builder. Change-Id: I4d26c568dfe6307b496719c10908a36933fd3ab8 Signed-off-by: Marc-Andre Laperle --- .../internal/tcmodification/ConfigurationModification.java | 7 ++++++- llvm/org.eclipse.cdt.managedbuilder.llvm.ui/plugin.xml | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/tcmodification/ConfigurationModification.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/tcmodification/ConfigurationModification.java index bdccea7cd26..d60c832c8c4 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/tcmodification/ConfigurationModification.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/tcmodification/ConfigurationModification.java @@ -103,7 +103,12 @@ public class ConfigurationModification extends FolderInfoModification implements @Override public CompatibilityStatus getBuilderCompatibilityStatus() { - return getCurrentBuilderCompatibilityInfo().getCompatibilityStatus(); + BuilderCompatibilityInfoElement currentBuilderCompatibilityInfo = getCurrentBuilderCompatibilityInfo(); + if (currentBuilderCompatibilityInfo == null) { + return new CompatibilityStatus(IStatus.ERROR, Messages.getString("ConfigurationModification.0"), null); //$NON-NLS-1$ + } + + return currentBuilderCompatibilityInfo.getCompatibilityStatus(); } private ConflictMatchSet getParentConflictMatchSet(){ diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/plugin.xml b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/plugin.xml index e803fc869b3..b5aabd8e6ae 100755 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/plugin.xml +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/plugin.xml @@ -1092,7 +1092,7 @@ targetTool="cdt.managedbuild.tool.llvm.archiver">