Don't abort during app image loading with no boot image
Fail gracefully instead. Fixes test 119.
Bug: 22858531
Change-Id: If17acf5365f8a8fc0a2f6445c558960c62c8f948
diff --git a/runtime/gc/space/image_space.cc b/runtime/gc/space/image_space.cc
index a84b366..fc186b1 100644
--- a/runtime/gc/space/image_space.cc
+++ b/runtime/gc/space/image_space.cc
@@ -938,9 +938,14 @@
const size_t pointer_size = image_header.GetPointerSize();
gc::Heap* const heap = Runtime::Current()->GetHeap();
heap->GetBootImagesSize(&boot_image_begin, &boot_image_end, &boot_oat_begin, &boot_oat_end);
- CHECK_NE(boot_image_begin, boot_image_end)
- << "Can not relocate app image without boot image space";
- CHECK_NE(boot_oat_begin, boot_oat_end) << "Can not relocate app image without boot oat file";
+ if (boot_image_begin == boot_image_end) {
+ *error_msg = "Can not relocate app image without boot image space";
+ return false;
+ }
+ if (boot_oat_begin == boot_oat_end) {
+ *error_msg = "Can not relocate app image without boot oat file";
+ return false;
+ }
const uint32_t boot_image_size = boot_image_end - boot_image_begin;
const uint32_t boot_oat_size = boot_oat_end - boot_oat_begin;
const uint32_t image_header_boot_image_size = image_header.GetBootImageSize();