From c7d38843dae58b489706593999fb697a8eda082f Mon Sep 17 00:00:00 2001 From: crschnick Date: Sat, 31 Aug 2024 08:21:56 +0000 Subject: [PATCH] Fix NPE --- .../main/java/io/xpipe/core/process/ShellDialects.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/io/xpipe/core/process/ShellDialects.java b/core/src/main/java/io/xpipe/core/process/ShellDialects.java index 68893c8bd..8c82f8de4 100644 --- a/core/src/main/java/io/xpipe/core/process/ShellDialects.java +++ b/core/src/main/java/io/xpipe/core/process/ShellDialects.java @@ -44,11 +44,11 @@ public class ShellDialects { } public static boolean isPowershell(ShellControl sc) { - return sc.getShellDialect().equals(POWERSHELL) || sc.getShellDialect().equals(POWERSHELL_CORE); - } + if (sc.getShellDialect() == null) { + return false; + } - public static ShellDialect byName(String name) { - return byNameIfPresent(name).orElseThrow(); + return sc.getShellDialect().equals(POWERSHELL) || sc.getShellDialect().equals(POWERSHELL_CORE); } public static Optional byNameIfPresent(String name) {