File tree 2 files changed +8
-6
lines changed
arduino-core/src/cc/arduino/contributions
2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change 52
52
import java .util .ArrayList ;
53
53
import java .util .Collections ;
54
54
import java .util .List ;
55
+ import java .util .Optional ;
55
56
56
57
import static processing .app .I18n .tr ;
57
58
@@ -151,8 +152,11 @@ public void rescanLibraries() {
151
152
.filter (l -> l .getTypes ().contains ("Contributed" )) //
152
153
.filter (l -> l .getLocation () == Location .CORE || l .getLocation () == Location .REFERENCED_CORE ) //
153
154
.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
+ }
156
160
});
157
161
}
158
162
Original file line number Diff line number Diff line change @@ -461,13 +461,11 @@ private List<ContributedPlatform> getInstalledPlatforms() {
461
461
return index .getInstalledPlatforms ();
462
462
}
463
463
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 -> {
466
466
assert contributedPlatform .getInstalledFolder () != null ;
467
467
return FileUtils .isSubDirectory (contributedPlatform .getInstalledFolder (), folder );
468
468
}).findFirst ();
469
-
470
- return platformOptional .orElse (null );
471
469
}
472
470
473
471
public ContributedPlatform getContributedPlaform (TargetPlatform targetPlatform ) {
You can’t perform that action at this time.
0 commit comments