Revert "Revert "ART: Fix up some multi-image cases""

This reverts commit de38b797c3e5ba3ee44c480db7093386975c51eb.

Fix up imgdiag for std::string and multi-image.

Bug: 26317072
Bug: 26320300

Change-Id: I94ce9528e9fea6fb3231a70c32db02d567143db9
diff --git a/runtime/oat_file_assistant.cc b/runtime/oat_file_assistant.cc
index cb80cc9..8543ff4 100644
--- a/runtime/oat_file_assistant.cc
+++ b/runtime/oat_file_assistant.cc
@@ -846,7 +846,12 @@
 
 std::string OatFileAssistant::ImageLocation() {
   Runtime* runtime = Runtime::Current();
-  return runtime->GetHeap()->GetBootImageSpaces()[0]->GetImageLocation();
+  const std::vector<gc::space::ImageSpace*>& image_spaces =
+      runtime->GetHeap()->GetBootImageSpaces();
+  if (image_spaces.empty()) {
+    return "";
+  }
+  return image_spaces[0]->GetImageLocation();
 }
 
 const uint32_t* OatFileAssistant::GetRequiredDexChecksum() {