Skip to content

Commit f58f8d3

Browse files
committed
Fix NPE crash after installing a library with invalid version
Fix #7917
1 parent 86217a4 commit f58f8d3

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Diff for: arduino-core/src/processing/app/packages/UserLibrary.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
*/
2929
package processing.app.packages;
3030

31+
import static processing.app.I18n.format;
32+
import static processing.app.I18n.tr;
33+
3134
import java.io.File;
3235
import java.io.IOException;
3336
import java.nio.file.Files;
@@ -42,7 +45,6 @@
4245
import cc.arduino.Constants;
4346
import cc.arduino.contributions.VersionHelper;
4447
import cc.arduino.contributions.libraries.ContributedLibraryReference;
45-
import processing.app.I18n;
4648
import processing.app.helpers.PreferencesMap;
4749
import processing.app.packages.UserLibraryFolder.Location;
4850

@@ -152,8 +154,8 @@ public static UserLibrary create(UserLibraryFolder libFolderDesc) throws IOExcep
152154
String declaredVersion = properties.get("version").trim();
153155
Optional<Version> version = VersionHelper.valueOf(declaredVersion);
154156
if (!version.isPresent()) {
155-
System.err.println(
156-
I18n.format("Invalid version '{0}' for library in: {1}", declaredVersion, libFolder.getAbsolutePath()));
157+
System.out.println(
158+
format(tr("Invalid version '{0}' for library in: {1}"), declaredVersion, libFolder.getAbsolutePath()));
157159
}
158160

159161
UserLibrary res = new UserLibrary();

0 commit comments

Comments
 (0)