Fixing gtest failure due to VerifyClassUsingOatFile change

Change-Id: I8d4ed31fada333013a56dcb7aebbd25f5323017c
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index 7cf6cd9..41ddef5 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -2321,6 +2321,12 @@
 
 
   const OatFile* oat_file = FindOpenedOatFileForDexFile(dex_file);
+  // Make this work with gtests, which do not set up the image properly.
+  // TODO: we should clean up gtests to set up the image path properly.
+  if (Runtime::Current()->IsCompiler() && (oat_file == NULL)) {
+    return false;
+  }
+
   CHECK(oat_file != NULL) << dex_file.GetLocation() << " " << PrettyClass(klass);
   const OatFile::OatDexFile* oat_dex_file = oat_file->GetOatDexFile(dex_file.GetLocation());
   CHECK(oat_dex_file != NULL) << dex_file.GetLocation() << " " << PrettyClass(klass);