mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-11-25 09:00:26 +00:00
Fix NPE
This commit is contained in:
parent
89b245a27c
commit
41786d99cd
1 changed files with 7 additions and 3 deletions
|
@ -34,6 +34,10 @@ public class SimpleScriptStore extends ScriptStore implements ShellInitCommand.T
|
||||||
private final boolean fileScript;
|
private final boolean fileScript;
|
||||||
private final boolean runnableScript;
|
private final boolean runnableScript;
|
||||||
|
|
||||||
|
public String getCommands() {
|
||||||
|
return commands != null ? commands : "";
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isCompatible(ShellControl shellControl) {
|
public boolean isCompatible(ShellControl shellControl) {
|
||||||
var targetType = shellControl.getOriginalShellDialect();
|
var targetType = shellControl.getOriginalShellDialect();
|
||||||
return minimumDialect.isCompatibleTo(targetType);
|
return minimumDialect.isCompatibleTo(targetType);
|
||||||
|
@ -45,9 +49,9 @@ public class SimpleScriptStore extends ScriptStore implements ShellInitCommand.T
|
||||||
|
|
||||||
private String assembleScript(ShellControl shellControl) {
|
private String assembleScript(ShellControl shellControl) {
|
||||||
if (isCompatible(shellControl)) {
|
if (isCompatible(shellControl)) {
|
||||||
var shebang = commands.startsWith("#");
|
var shebang = getCommands().startsWith("#");
|
||||||
// Fix new lines and shebang
|
// Fix new lines and shebang
|
||||||
var fixedCommands = commands.lines()
|
var fixedCommands = getCommands().lines()
|
||||||
.skip(shebang ? 1 : 0)
|
.skip(shebang ? 1 : 0)
|
||||||
.collect(Collectors.joining(
|
.collect(Collectors.joining(
|
||||||
shellControl.getShellDialect().getNewLine().getNewLineString()));
|
shellControl.getShellDialect().getNewLine().getNewLineString()));
|
||||||
|
@ -77,7 +81,7 @@ public class SimpleScriptStore extends ScriptStore implements ShellInitCommand.T
|
||||||
Validators.nonNull(group);
|
Validators.nonNull(group);
|
||||||
super.checkComplete();
|
super.checkComplete();
|
||||||
Validators.nonNull(minimumDialect);
|
Validators.nonNull(minimumDialect);
|
||||||
if (!initScript && !shellScript && !fileScript && !isRunnableScript()) {
|
if (!initScript && !shellScript && !fileScript && !runnableScript) {
|
||||||
throw new ValidationException(AppI18n.get("app.valueMustNotBeEmpty"));
|
throw new ValidationException(AppI18n.get("app.valueMustNotBeEmpty"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue