Fix CTS failures caused by ignoring malformed dex files in dex2oat

Bug: 11621003
Bug: 11599365

(cherry-picked from commit d5aba599561d8d14bb8c19fd633bfcd05af3c264)

Change-Id: Ie204d634f6951f6856ed92e2191f07262b28bc05
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc
index c4cce2f..0be15fc 100644
--- a/dex2oat/dex2oat.cc
+++ b/dex2oat/dex2oat.cc
@@ -416,6 +416,11 @@
   for (size_t i = 0; i < dex_filenames.size(); i++) {
     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);
     if (dex_file == NULL) {
       LOG(WARNING) << "Failed to open .dex from file '" << dex_filename << "'\n";