File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed
arduino-core/src/cc/arduino/contributions Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change 5252import java .util .ArrayList ;
5353import java .util .Collections ;
5454import java .util .List ;
55+ import java .util .Optional ;
5556
5657import static processing .app .I18n .tr ;
5758
@@ -151,8 +152,11 @@ public void rescanLibraries() {
151152 .filter (l -> l .getTypes ().contains ("Contributed" )) //
152153 .filter (l -> l .getLocation () == Location .CORE || l .getLocation () == Location .REFERENCED_CORE ) //
153154 .forEach (l -> {
154- ContributedPlatform platform = BaseNoGui .indexer .getPlatformByFolder (l .getInstalledFolder ());
155- l .setTypes (Collections .singletonList (platform .getCategory ()));
155+ File libFolder = l .getInstalledFolder ();
156+ Optional <ContributedPlatform > platform = BaseNoGui .indexer .getPlatformByFolder (libFolder );
157+ if (platform .isPresent ()) {
158+ l .setTypes (Collections .singletonList (platform .get ().getCategory ()));
159+ }
156160 });
157161 }
158162
Original file line number Diff line number Diff line change @@ -461,13 +461,11 @@ private List<ContributedPlatform> getInstalledPlatforms() {
461461 return index .getInstalledPlatforms ();
462462 }
463463
464- public ContributedPlatform getPlatformByFolder (final File folder ) {
465- Optional < ContributedPlatform > platformOptional = getInstalledPlatforms ().stream ().filter (contributedPlatform -> {
464+ public Optional < ContributedPlatform > getPlatformByFolder (final File folder ) {
465+ return getInstalledPlatforms ().stream ().filter (contributedPlatform -> {
466466 assert contributedPlatform .getInstalledFolder () != null ;
467467 return FileUtils .isSubDirectory (contributedPlatform .getInstalledFolder (), folder );
468468 }).findFirst ();
469-
470- return platformOptional .orElse (null );
471469 }
472470
473471 public ContributedPlatform getContributedPlaform (TargetPlatform targetPlatform ) {
You can’t perform that action at this time.
0 commit comments