mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-30 16:24:09 +03:00
Libraries: fixed incorrect handling of null types
This commit is contained in:
@ -16,6 +16,12 @@ public class LibraryByTypeComparator implements Comparator<ContributedLibrary> {
|
||||
|
||||
@Override
|
||||
public int compare(ContributedLibrary o1, ContributedLibrary o2) {
|
||||
if (o1.getTypes() == null) {
|
||||
return 1;
|
||||
}
|
||||
if (o2.getTypes() == null) {
|
||||
return -1;
|
||||
}
|
||||
return libraryTypeComparator.compare(o1.getTypes().get(0), o2.getTypes().get(0));
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,12 @@ public class LibraryOfSameTypeComparator implements Comparator<ContributedLibrar
|
||||
|
||||
@Override
|
||||
public int compare(ContributedLibrary o1, ContributedLibrary o2) {
|
||||
if (o1.getTypes() == null) {
|
||||
return 1;
|
||||
}
|
||||
if (o2.getTypes() == null) {
|
||||
return -1;
|
||||
}
|
||||
if (!o1.getTypes().get(0).equals(o2.getTypes().get(0))) {
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user