Skip to content

Commit bdf150c

Browse files
committed
fix: fixed NPE when running as a native image
Fixes #87
1 parent 0042820 commit bdf150c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/main/java/dev/jbang/devkitman/JdkManager.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,11 @@ public void removeDefaultJdk() {
601601
}
602602

603603
public boolean isCurrentJdkManaged() {
604-
Path currentJdk = Paths.get(System.getProperty("java.home"));
604+
String jh = System.getProperty("java.home");
605+
if (jh == null) {
606+
return false;
607+
}
608+
Path currentJdk = Paths.get(jh);
605609
return providers(JdkProvider.Predicates.canUpdate)
606610
.anyMatch(p -> p.getInstalledByPath(currentJdk) != null);
607611
}

0 commit comments

Comments
 (0)