Skip to content

Commit e0b2cd0

Browse files
committed
Handle invalid versions without NullPointerExceptions
1 parent d20e608 commit e0b2cd0

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

arduino-core/src/processing/app/BaseNoGui.java

+7-3
Original file line numberDiff line numberDiff line change
@@ -899,9 +899,13 @@ public static void createToolPreferences(Collection<ContributedTool> installedTo
899899
PreferencesData.set(prefix + toolName + "-" + toolVersion + ".path", toolPath);
900900
PreferencesData.set(prefix + tool.getPackager() + "-" + toolName + "-" + toolVersion + ".path", toolPath);
901901
// In the generic tool property put the path of the latest version if more are available
902-
if (!latestVersions.containsKey(toolName) || comparator.greaterThan(toolVersion, latestVersions.get(toolName))) {
903-
latestVersions.put(toolName, toolVersion);
904-
PreferencesData.set(prefix + toolName + ".path", toolPath);
902+
try {
903+
if (!latestVersions.containsKey(toolName) || comparator.greaterThan(toolVersion, latestVersions.get(toolName))) {
904+
latestVersions.put(toolName, toolVersion);
905+
PreferencesData.set(prefix + toolName + ".path", toolPath);
906+
}
907+
} catch (Exception e) {
908+
// Ignore invalid versions
905909
}
906910
}
907911
}

0 commit comments

Comments
 (0)