Fix a NullPointerException when there are no test results.

If there are no test results (e.g. if the build fails before the tests run)
then build.getAction(AbstractTestResultAction.class) returns null.
Add a check for this case.