From ba09c7511c3c5be9bc41efa0317cc791fcf65890 Mon Sep 17 00:00:00 2001 From: Martin Sidaway Date: Wed, 24 Jun 2015 17:58:31 +0100 Subject: [PATCH] Handle duplicates of legacy libs correctly. (#3412) --- .../arduino/contributions/libraries/ContributedLibrary.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arduino-core/src/cc/arduino/contributions/libraries/ContributedLibrary.java b/arduino-core/src/cc/arduino/contributions/libraries/ContributedLibrary.java index c6615c3ba..686f3411c 100644 --- a/arduino-core/src/cc/arduino/contributions/libraries/ContributedLibrary.java +++ b/arduino-core/src/cc/arduino/contributions/libraries/ContributedLibrary.java @@ -142,7 +142,10 @@ public abstract class ContributedLibrary extends DownloadableContribution { String thisVersion = getParsedVersion(); String otherVersion = ((ContributedLibrary) obj).getParsedVersion(); - boolean versionEquals = thisVersion != null && otherVersion != null && thisVersion.equals(otherVersion); + // Important: for legacy libs, versions are null. Two legacy libs must + // always pass this test. + boolean versionEquals = thisVersion == otherVersion || + (thisVersion != null && otherVersion != null && thisVersion.equals(otherVersion)); String thisName = getName(); String otherName = ((ContributedLibrary) obj).getName();