Fix CTS failures caused by ignoring malformed dex files in dex2oat

Bug: 11621003
Bug: 11599365
Change-Id: If1f62dff59346edcd60e4c4b5df58137609f7f19
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc
index 5b0653e..3781921 100644
--- a/dex2oat/dex2oat.cc
+++ b/dex2oat/dex2oat.cc
@@ -427,6 +427,10 @@
     const char* dex_filename = dex_filenames[i];
     const char* dex_location = dex_locations[i];
     std::string error_msg;
+    if (!OS::FileExists(dex_filename)) {
+      LOG(WARNING) << "Skipping non-existent dex file '" << dex_filename << "'";
+      continue;
+    }
     const DexFile* dex_file = DexFile::Open(dex_filename, dex_location, &error_msg);
     if (dex_file == NULL) {
       LOG(WARNING) << "Failed to open .dex from file '" << dex_filename << "': " << error_msg;