Fix segfault when an invalid command is issued

First check if we actually find an entry inside the action map before processing it further.