From cd149c3fcb0bf0d31dc81b405a04274e76b0ea06 Mon Sep 17 00:00:00 2001 From: Charlie Moog Date: Tue, 5 Jan 2021 17:12:02 +0000 Subject: [PATCH] fix: patch config-ssh panic condition --- internal/cmd/configssh.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/cmd/configssh.go b/internal/cmd/configssh.go index 5af1ea56..38f1145c 100644 --- a/internal/cmd/configssh.go +++ b/internal/cmd/configssh.go @@ -152,9 +152,10 @@ func removeOldConfig(config string) (string, bool) { if startIndex == -1 || endIndex == -1 { return config, false } - config = config[:startIndex-1] + config[endIndex+len(sshEndToken)+1:] - - return config, true + if startIndex == 0 { + return config[endIndex+len(sshEndToken)+1:], true + } + return config[:startIndex-1] + config[endIndex+len(sshEndToken)+1:], true } // sshAvailable returns true if SSH is available for at least one environment.