Fix implementation of clish_command_choose_longest
This was not fully NULL-proof although it could be.
This now implements "choose longest or only", which is what we want.
There is no in-tree code path that triggers the NULL-problem, but it
popped up while patching other code and IMO this should be fixed.