From 9aa8bfa1a20d4997b7b9df7ce05d95a752f5f230 Mon Sep 17 00:00:00 2001 From: Maidul Islam Date: Mon, 9 Jan 2023 19:43:01 -0500 Subject: [PATCH] check if err is not nil first before checking error prefix --- cli/packages/cmd/login.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cli/packages/cmd/login.go b/cli/packages/cmd/login.go index 26ec348d2..d5bf400b1 100644 --- a/cli/packages/cmd/login.go +++ b/cli/packages/cmd/login.go @@ -32,9 +32,9 @@ var loginCmd = &cobra.Command{ PreRun: toggleDebug, Run: func(cmd *cobra.Command, args []string) { currentLoggedInUserDetails, err := util.GetCurrentLoggedInUserDetails() - if strings.Contains(err.Error(), "The specified item could not be found in the keyring") { // if the key can't be found allow them to override + if err != nil && strings.Contains(err.Error(), "The specified item could not be found in the keyring") { // if the key can't be found allow them to override log.Debug(err) - } else { + } else if err != nil { util.HandleError(err) }