Better error handling when CTS build is not valid.

Change-Id: I02868b41b43220c559613c9164153fc562535142
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/result/CtsXmlResultReporter.java b/tools/tradefed-host/src/com/android/cts/tradefed/result/CtsXmlResultReporter.java
index 3eaa88c..e95ab71 100644
--- a/tools/tradefed-host/src/com/android/cts/tradefed/result/CtsXmlResultReporter.java
+++ b/tools/tradefed-host/src/com/android/cts/tradefed/result/CtsXmlResultReporter.java
@@ -148,7 +148,8 @@
         try {
             buildHelper.validateStructure();
         } catch (FileNotFoundException e) {
-            throw new IllegalArgumentException("Invalid CTS build", e);
+            // just log an error - it might be expected if we failed to retrieve a build
+            CLog.e("Invalid CTS build %s", ctsBuild.getRootDir());
         }
         return buildHelper;
     }
@@ -248,6 +249,11 @@
         if (mCurrentPkgResult != null) {
             logCompleteRun(mCurrentPkgResult);
         }
+        if (mReportDir == null || mStartTime == null) {
+            // invocationStarted must have failed, abort
+            CLog.w("Unable to create XML report");
+            return;
+        }
         createXmlResult(mReportDir, mStartTime, elapsedTime);
         copyFormattingFiles(mReportDir);
         zipResults(mReportDir);