From d518d7683caddd00d48762938f3e89719a7139cc Mon Sep 17 00:00:00 2001 From: Martino Facchin Date: Mon, 6 May 2019 15:10:33 +0200 Subject: [PATCH] Fix NPEs if no hardware core is installed Fixes #8229 --- .../arduino/contributions/packages/ContributionsIndexer.java | 2 +- arduino-core/src/processing/app/BaseNoGui.java | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/arduino-core/src/cc/arduino/contributions/packages/ContributionsIndexer.java b/arduino-core/src/cc/arduino/contributions/packages/ContributionsIndexer.java index a1ca10929..35a53e906 100644 --- a/arduino-core/src/cc/arduino/contributions/packages/ContributionsIndexer.java +++ b/arduino-core/src/cc/arduino/contributions/packages/ContributionsIndexer.java @@ -215,7 +215,7 @@ public class ContributionsIndexer { } private void syncBuiltInHardware() throws IOException { - if (index == null) { + if (index == null || builtInHardwareFolder == null) { return; } for (File folder : builtInHardwareFolder.listFiles(ONLY_DIRS)) { diff --git a/arduino-core/src/processing/app/BaseNoGui.java b/arduino-core/src/processing/app/BaseNoGui.java index 920d0e068..37d4b33e9 100644 --- a/arduino-core/src/processing/app/BaseNoGui.java +++ b/arduino-core/src/processing/app/BaseNoGui.java @@ -676,7 +676,9 @@ public class BaseNoGui { // Libraries located in the latest folders on the list can override // other libraries with the same name. librariesIndexer.setLibrariesFolders(librariesFolders); - librariesIndexer.setArchitecturePriority(getTargetPlatform().getId()); + if (getTargetPlatform() != null) { + librariesIndexer.setArchitecturePriority(getTargetPlatform().getId()); + } librariesIndexer.rescanLibraries(); populateImportToLibraryTable();