diff options
| -rw-r--r-- | runtime/oat_file.cc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/runtime/oat_file.cc b/runtime/oat_file.cc index c33a9cd6d1..ec28685e2d 100644 --- a/runtime/oat_file.cc +++ b/runtime/oat_file.cc @@ -954,7 +954,12 @@ OatFile* OatFile::Open(const std::string& filename, ScopedTrace trace("Open oat file " + location); CHECK(!filename.empty()) << location; CheckLocation(location); - std::unique_ptr<OatFile> ret; + + // Check that the file even exists, fast-fail. + if (!OS::FileExists(filename.c_str())) { + *error_msg = StringPrintf("File %s does not exist.", filename.c_str()); + return nullptr; + } // Try dlopen first, as it is required for native debuggability. This will fail fast if dlopen is // disabled. |