Fix crash on empty command

Commit 980549d introduced printing the name of the command if it's not
found. However, it breaks if the command is nil.

This commit adds a check for command being nil before it's printed.