mirror of
https://github.com/arduino/Arduino.git
synced 2024-11-29 10:24:12 +01:00
Fix NPE crash after installing a library with invalid version
Fix #7917
This commit is contained in:
parent
86217a4fb4
commit
f58f8d3c4b
@ -28,6 +28,9 @@
|
||||
*/
|
||||
package processing.app.packages;
|
||||
|
||||
import static processing.app.I18n.format;
|
||||
import static processing.app.I18n.tr;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
@ -42,7 +45,6 @@ import com.github.zafarkhaja.semver.Version;
|
||||
import cc.arduino.Constants;
|
||||
import cc.arduino.contributions.VersionHelper;
|
||||
import cc.arduino.contributions.libraries.ContributedLibraryReference;
|
||||
import processing.app.I18n;
|
||||
import processing.app.helpers.PreferencesMap;
|
||||
import processing.app.packages.UserLibraryFolder.Location;
|
||||
|
||||
@ -152,8 +154,8 @@ public class UserLibrary {
|
||||
String declaredVersion = properties.get("version").trim();
|
||||
Optional<Version> version = VersionHelper.valueOf(declaredVersion);
|
||||
if (!version.isPresent()) {
|
||||
System.err.println(
|
||||
I18n.format("Invalid version '{0}' for library in: {1}", declaredVersion, libFolder.getAbsolutePath()));
|
||||
System.out.println(
|
||||
format(tr("Invalid version '{0}' for library in: {1}"), declaredVersion, libFolder.getAbsolutePath()));
|
||||
}
|
||||
|
||||
UserLibrary res = new UserLibrary();
|
||||
|
Loading…
Reference in New Issue
Block a user