Skip to content

Commit ba09c75

Browse files
committed
Handle duplicates of legacy libs correctly. (#3412)
1 parent 98eb1a9 commit ba09c75

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

arduino-core/src/cc/arduino/contributions/libraries/ContributedLibrary.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,10 @@ public boolean equals(Object obj) {
142142
String thisVersion = getParsedVersion();
143143
String otherVersion = ((ContributedLibrary) obj).getParsedVersion();
144144

145-
boolean versionEquals = thisVersion != null && otherVersion != null && thisVersion.equals(otherVersion);
145+
// Important: for legacy libs, versions are null. Two legacy libs must
146+
// always pass this test.
147+
boolean versionEquals = thisVersion == otherVersion ||
148+
(thisVersion != null && otherVersion != null && thisVersion.equals(otherVersion));
146149

147150
String thisName = getName();
148151
String otherName = ((ContributedLibrary) obj).getName();

0 commit comments

Comments
 (0)