mirror of
https://github.com/arduino/Arduino.git
synced 2025-02-20 14:54:31 +01:00
Fixed NPE in some rare combinations of JSON files
The error triggered inside ContributioIndexer.mergeContributions() while trying to remove a platform: if (platform != null) { targetPackage.getPlatforms().remove(platform); } remove() method calls ContributedPlatform.equals() to find the element to remove but since the parentPackage fields are resolved *after* merging contributions, the equls() method will fail with a NullPointerException.
This commit is contained in:
parent
fa4876b7b1
commit
7c089c96d3
@ -108,6 +108,24 @@ public abstract class ContributedPlatform extends DownloadableContribution {
|
||||
}
|
||||
|
||||
ContributedPlatform obj1 = (ContributedPlatform) obj;
|
||||
return getParentPackage().getName().equals(obj1.getParentPackage().getName()) && getArchitecture().equals(obj1.getArchitecture()) && getVersion().equals(obj1.getVersion()) && getName().equals(obj1.getName());
|
||||
|
||||
ContributedPackage parentPackage = getParentPackage();
|
||||
ContributedPackage parentPackage1 = obj1.getParentPackage();
|
||||
if (parentPackage == null) {
|
||||
if (parentPackage1 != null)
|
||||
return false;
|
||||
} else {
|
||||
if (parentPackage1 == null)
|
||||
return false;
|
||||
if (!parentPackage.getName().equals(parentPackage1.getName()))
|
||||
return false;
|
||||
}
|
||||
if (!getArchitecture().equals(obj1.getArchitecture())) {
|
||||
return false;
|
||||
}
|
||||
if (!getVersion().equals(obj1.getVersion())) {
|
||||
return false;
|
||||
}
|
||||
return getName().equals(obj1.getName());
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user