mirror of
https://github.com/xpipe-io/xpipe.git
synced 2025-04-16 17:23:35 +00:00
Fix NPE in temp check
This commit is contained in:
parent
8bc5ea0688
commit
a1575f4042
1 changed files with 10 additions and 6 deletions
|
@ -12,9 +12,11 @@ public class AppTempCheck {
|
|||
|
||||
private static void checkTemp(String tmpdir) {
|
||||
Path dir = null;
|
||||
try {
|
||||
dir = Path.of(tmpdir);
|
||||
} catch (InvalidPathException ignored) {
|
||||
if (tmpdir != null) {
|
||||
try {
|
||||
dir = Path.of(tmpdir);
|
||||
} catch (InvalidPathException ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
if (dir == null || !Files.exists(dir) || !Files.isDirectory(dir)) {
|
||||
|
@ -27,9 +29,11 @@ public class AppTempCheck {
|
|||
}
|
||||
|
||||
public static void check() {
|
||||
if (OsType.getLocal().equals(OsType.WINDOWS)) {
|
||||
checkTemp(System.getProperty("java.io.tmpdir"));
|
||||
checkTemp(System.getenv("TEMP"));
|
||||
if (!OsType.getLocal().equals(OsType.WINDOWS)) {
|
||||
return;
|
||||
}
|
||||
|
||||
checkTemp(System.getProperty("java.io.tmpdir"));
|
||||
checkTemp(System.getenv("TEMP"));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue