ART: Allow uninitialized runtime in oat code
Oatdump does not initialize a runtime. Avoid a segfault.
Bug: 17194559
Change-Id: I1a1bd3fc7762ff4714251617a975e832522fa879
diff --git a/runtime/oat_file.cc b/runtime/oat_file.cc
index 9afad2b..6305994 100644
--- a/runtime/oat_file.cc
+++ b/runtime/oat_file.cc
@@ -531,7 +531,9 @@
methods_pointer_index = num_set_bits;
}
const OatMethodOffsets& oat_method_offsets = methods_pointer_[methods_pointer_index];
- if (oat_file_->IsExecutable() || Runtime::Current()->IsCompiler()) {
+ if (oat_file_->IsExecutable() ||
+ Runtime::Current() == nullptr || // This case applies for oatdump.
+ Runtime::Current()->IsCompiler()) {
return OatMethod(
oat_file_->Begin(),
oat_method_offsets.code_offset_,