Don't read characters from 0 length strings.

Caught by valgrind. Bug: 11670287

Change-Id: I3acf4855c8662b804cf0c24680fc21c50c435bdb
diff --git a/compiler/image_writer.cc b/compiler/image_writer.cc
index d2d7c0a..740babd 100644
--- a/compiler/image_writer.cc
+++ b/compiler/image_writer.cc
@@ -260,7 +260,12 @@
   const uint16_t* utf16_string = string->GetCharArray()->GetData() + string->GetOffset();
   for (DexCache* dex_cache : Runtime::Current()->GetClassLinker()->GetDexCaches()) {
     const DexFile& dex_file = *dex_cache->GetDexFile();
-    const DexFile::StringId* string_id = dex_file.FindStringId(utf16_string);
+    const DexFile::StringId* string_id;
+    if (UNLIKELY(string->GetLength() == 0)) {
+      string_id = dex_file.FindStringId("");
+    } else {
+      string_id = dex_file.FindStringId(utf16_string);
+    }
     if (string_id != nullptr) {
       // This string occurs in this dex file, assign the dex cache entry.
       uint32_t string_idx = dex_file.GetIndexForStringId(*string_id);