Skip to content

Commit 14586af

Browse files
author
Federico Fissore
committed
Fixed possible NPE
1 parent 39c3f8b commit 14586af

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

arduino-core/src/cc/arduino/contributions/packages/ContributionsIndex.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,11 @@ public List<ContributedPlatform> getInstalledPlatforms() {
8888
}
8989

9090
public ContributedPlatform getInstalledPlatform(String packageName, String platformArch) {
91-
List<ContributedPlatform> installedPlatforms = new LinkedList<>(Collections2.filter(findPlatforms(packageName, platformArch), new InstalledPredicate()));
91+
List<ContributedPlatform> platforms = findPlatforms(packageName, platformArch);
92+
if (platforms == null) {
93+
return null;
94+
}
95+
List<ContributedPlatform> installedPlatforms = new LinkedList<>(Collections2.filter(platforms, new InstalledPredicate()));
9296
Collections.sort(installedPlatforms, new DownloadableContributionBuiltInAtTheBottomComparator());
9397

9498
if (installedPlatforms.isEmpty()) {

0 commit comments

Comments
 (0)