From ce857c058c4eebc8e175d12d445a6f54e9ec7c57 Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Fri, 25 May 2018 15:28:34 -0400 Subject: [PATCH] Bug 535139 - Container target set-up causes NPE - add null check before accessing ordered tool chains Change-Id: I713a55f8e887b642aa4a159e59c454de9a97955a --- .../internal/core/build/ToolChainManager.java | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/ToolChainManager.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/ToolChainManager.java index fc60b74cdb2..7c882ddb1cf 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/ToolChainManager.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/ToolChainManager.java @@ -189,19 +189,21 @@ public class ToolChainManager implements IToolChainManager { public Collection getToolChainsMatching(Map properties) { init(); List tcs = new ArrayList<>(); - for (IToolChain toolChain : orderedToolChains) { - boolean matches = true; - for (Map.Entry property : properties.entrySet()) { - String tcProperty = toolChain.getProperty(property.getKey()); - if (tcProperty != null) { - if (!property.getValue().equals(tcProperty)) { - matches = false; - break; + if (orderedToolChains != null) { + for (IToolChain toolChain : orderedToolChains) { + boolean matches = true; + for (Map.Entry property : properties.entrySet()) { + String tcProperty = toolChain.getProperty(property.getKey()); + if (tcProperty != null) { + if (!property.getValue().equals(tcProperty)) { + matches = false; + break; + } } } - } - if (matches) { - tcs.add(toolChain); + if (matches) { + tcs.add(toolChain); + } } }