1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-01-19 08:52:15 +01:00

Handle invalid versions without NullPointerExceptions

This commit is contained in:
Cristian Maglie 2016-08-05 17:55:15 +02:00
parent d20e608623
commit e0b2cd0ffe

View File

@ -899,9 +899,13 @@ public class BaseNoGui {
PreferencesData.set(prefix + toolName + "-" + toolVersion + ".path", toolPath); PreferencesData.set(prefix + toolName + "-" + toolVersion + ".path", toolPath);
PreferencesData.set(prefix + tool.getPackager() + "-" + toolName + "-" + toolVersion + ".path", toolPath); PreferencesData.set(prefix + tool.getPackager() + "-" + toolName + "-" + toolVersion + ".path", toolPath);
// In the generic tool property put the path of the latest version if more are available // In the generic tool property put the path of the latest version if more are available
if (!latestVersions.containsKey(toolName) || comparator.greaterThan(toolVersion, latestVersions.get(toolName))) { try {
latestVersions.put(toolName, toolVersion); if (!latestVersions.containsKey(toolName) || comparator.greaterThan(toolVersion, latestVersions.get(toolName))) {
PreferencesData.set(prefix + toolName + ".path", toolPath); latestVersions.put(toolName, toolVersion);
PreferencesData.set(prefix + toolName + ".path", toolPath);
}
} catch (Exception e) {
// Ignore invalid versions
} }
} }
} }