Skip to content

Commit f8e3058

Browse files
committed
fix crash
1 parent b626981 commit f8e3058

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

command.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,12 @@ func (thisRef *Command) parseAndExecute(execute bool) error {
5353

5454
// 2. find root and ask to parse flags
5555
commandToExecute := thisRef.getLastSubcommandFlagedForExecute()
56-
if execute && helpsIsWanted {
57-
commandToExecute.showUsage()
58-
} else if execute && commandToExecute.Handler != nil {
59-
commandToExecute.Handler(commandToExecute)
56+
if commandToExecute != nil {
57+
if execute && helpsIsWanted {
58+
commandToExecute.showUsage()
59+
} else if execute && commandToExecute.Handler != nil {
60+
commandToExecute.Handler(commandToExecute)
61+
}
6062
}
6163

6264
return nil

0 commit comments

Comments
 (0)