Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 9191442

Browse files
author
Federico Fissore
committed
Libraries: fixed incorrect handling of null types
1 parent f13fe9a commit 9191442

File tree

3 files changed

+14
-62
lines changed

3 files changed

+14
-62
lines changed

‎app/src/cc/arduino/contributions/libraries/LibraryByTypeComparator.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ public LibraryByTypeComparator(LibraryTypeComparator libraryTypeComparator) {
1616

1717
@Override
1818
public int compare(ContributedLibrary o1, ContributedLibrary o2) {
19+
if (o1.getTypes() == null) {
20+
return 1;
21+
}
22+
if (o2.getTypes() == null) {
23+
return -1;
24+
}
1925
return libraryTypeComparator.compare(o1.getTypes().get(0), o2.getTypes().get(0));
2026
}
2127

‎app/src/cc/arduino/contributions/libraries/LibraryOfSameTypeComparator.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ public class LibraryOfSameTypeComparator implements Comparator<ContributedLibrar
66

77
@Override
88
public int compare(ContributedLibrary o1, ContributedLibrary o2) {
9+
if (o1.getTypes() == null) {
10+
return 1;
11+
}
12+
if (o2.getTypes() == null) {
13+
return -1;
14+
}
915
if (!o1.getTypes().get(0).equals(o2.getTypes().get(0))) {
1016
return 0;
1117
}

‎arduino-core/src/processing/app/packages/LegacyUserLibrary.java

Lines changed: 2 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@
3232
import java.util.Arrays;
3333
import java.util.List;
3434

35-
import cc.arduino.contributions.libraries.ContributedLibraryReference;
36-
3735
public class LegacyUserLibrary extends UserLibrary {
3836

3937
private String name;
@@ -45,6 +43,8 @@ public static LegacyUserLibrary create(File libFolder) {
4543
res.setInstalled(true);
4644
res.layout = LibraryLayout.FLAT;
4745
res.name = libFolder.getName();
46+
res.setTypes(Arrays.asList("Contributed"));
47+
res.setCategory("Uncategorized");
4848
return res;
4949
}
5050

@@ -58,66 +58,6 @@ public List<String> getArchitectures() {
5858
return Arrays.asList("*");
5959
}
6060

61-
@Override
62-
public String getAuthor() {
63-
return null;
64-
}
65-
66-
@Override
67-
public String getParagraph() {
68-
return null;
69-
}
70-
71-
@Override
72-
public String getSentence() {
73-
return null;
74-
}
75-
76-
@Override
77-
public String getWebsite() {
78-
return null;
79-
}
80-
81-
@Override
82-
public String getCategory() {
83-
return "Uncategorized";
84-
}
85-
86-
@Override
87-
public String getLicense() {
88-
return null;
89-
}
90-
91-
@Override
92-
public String getVersion() {
93-
return null;
94-
}
95-
96-
@Override
97-
public String getMaintainer() {
98-
return null;
99-
}
100-
101-
@Override
102-
public String getChecksum() {
103-
return null;
104-
}
105-
106-
@Override
107-
public long getSize() {
108-
return 0;
109-
}
110-
111-
@Override
112-
public String getUrl() {
113-
return null;
114-
}
115-
116-
@Override
117-
public List<ContributedLibraryReference> getRequires() {
118-
return null;
119-
}
120-
12161
@Override
12262
public String toString() {
12363
return "LegacyLibrary:" + name + "\n";

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /