fix: Preventing a panic when not using a sub command

This commit is contained in:
Gary Holtz 2023-06-28 11:41:23 -05:00
parent 1f8464b403
commit 7932b105ba
No known key found for this signature in database
GPG Key ID: 0C3B92677CFEE92F
1 changed files with 10 additions and 1 deletions

View File

@ -162,7 +162,16 @@ func main() {
checkUpdate, _ := cfg.Get("", "check_update")
if checkUpdate, err := strconv.ParseBool(checkUpdate); err == nil && checkUpdate {
err = update.CheckUpdate(cmdFactory, version, true, expandedArgs[0])
var argCommand string
if expandedArgs != nil {
argCommand = expandedArgs[0]
} else {
argCommand = ""
}
err = update.CheckUpdate(cmdFactory, version, true, argCommand)
if err != nil {
printError(cmdFactory.IO, err, rootCmd, debug, false)
}