Protect against null result when running command

In some situations (I think it's related to JS errors on the page), the result of runCommand will be null and the resulting check for an error then causes an error, this is a trivial fix up