mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Fix possible exception
This commit is contained in:
@@ -17,7 +17,6 @@ package org.jetbrains.plugins.terminal;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.intellij.execution.TaskExecutor;
|
||||
import com.intellij.execution.configurations.EncodingEnvironmentUtil;
|
||||
import com.intellij.execution.process.ProcessAdapter;
|
||||
import com.intellij.execution.process.ProcessEvent;
|
||||
import com.intellij.execution.process.ProcessHandler;
|
||||
@@ -71,8 +70,13 @@ public class LocalTerminalDirectRunner extends AbstractTerminalRunner<PtyProcess
|
||||
return name.equals("bash") || name.equals("sh") || name.equals("zsh");
|
||||
}
|
||||
|
||||
private static String getShellName(String path) {
|
||||
return new File(path).getName();
|
||||
private static String getShellName(@Nullable String path) {
|
||||
if (path == null) {
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
return new File(path).getName();
|
||||
}
|
||||
}
|
||||
|
||||
private static String findRCFile(String shellName) {
|
||||
@@ -181,9 +185,8 @@ public class LocalTerminalDirectRunner extends AbstractTerminalRunner<PtyProcess
|
||||
if (SystemInfo.isUnix) {
|
||||
List<String> command = Lists.newArrayList(shellPath.split(" "));
|
||||
|
||||
String shellCommand = command.get(0);
|
||||
String shellName = command.size() > 0 ? getShellName(shellCommand) : null;
|
||||
|
||||
String shellCommand = command.size() > 0 ? command.get(0) : null;
|
||||
String shellName = getShellName(shellCommand);
|
||||
|
||||
if (shellName != null) {
|
||||
command.remove(0);
|
||||
|
||||
Reference in New Issue
Block a user