1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-03-15 12:29:26 +01:00

Fix NPE if referred core is nonexistent

Fixes #5502
This commit is contained in:
Martino Facchin 2016-10-27 09:52:40 +02:00
parent de9bd89a01
commit 12eb09f0b9

View File

@ -162,13 +162,15 @@ public class BaseNoGui {
// Add all tools dependencies from the (possibily) referenced core // Add all tools dependencies from the (possibily) referenced core
String core = prefs.get("build.core"); String core = prefs.get("build.core");
if (core.contains(":")) { if (core != null && core.contains(":")) {
String split[] = core.split(":"); String split[] = core.split(":");
TargetPlatform referenced = BaseNoGui.getCurrentTargetPlatformFromPackage(split[0]); TargetPlatform referenced = BaseNoGui.getCurrentTargetPlatformFromPackage(split[0]);
if (referenced != null) {
ContributedPlatform referencedPlatform = indexer.getContributedPlaform(referenced); ContributedPlatform referencedPlatform = indexer.getContributedPlaform(referenced);
if (referencedPlatform != null) if (referencedPlatform != null)
requiredTools.addAll(referencedPlatform.getResolvedTools()); requiredTools.addAll(referencedPlatform.getResolvedTools());
} }
}
String prefix = "runtime.tools."; String prefix = "runtime.tools.";
for (ContributedTool tool : requiredTools) { for (ContributedTool tool : requiredTools) {