Skip to content

Commit 12eb09f

Browse files
committed
Fix NPE if referred core is nonexistent
Fixes #5502
1 parent de9bd89 commit 12eb09f

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

arduino-core/src/processing/app/BaseNoGui.java

+6-4
Original file line numberDiff line numberDiff line change
@@ -162,12 +162,14 @@ static public PreferencesMap getBoardPreferences() {
162162

163163
// Add all tools dependencies from the (possibily) referenced core
164164
String core = prefs.get("build.core");
165-
if (core.contains(":")) {
165+
if (core != null && core.contains(":")) {
166166
String split[] = core.split(":");
167167
TargetPlatform referenced = BaseNoGui.getCurrentTargetPlatformFromPackage(split[0]);
168-
ContributedPlatform referencedPlatform = indexer.getContributedPlaform(referenced);
169-
if (referencedPlatform != null)
170-
requiredTools.addAll(referencedPlatform.getResolvedTools());
168+
if (referenced != null) {
169+
ContributedPlatform referencedPlatform = indexer.getContributedPlaform(referenced);
170+
if (referencedPlatform != null)
171+
requiredTools.addAll(referencedPlatform.getResolvedTools());
172+
}
171173
}
172174

173175
String prefix = "runtime.tools.";

0 commit comments

Comments
 (0)