Fix updating string dex cache array for no class table case
The issue was that array classes do not have a dex cache. Also removed
some unnecessary mutables.
Bug: 22858531
Change-Id: I2bc45f019e064b6e562c8f158cc2ac8c0e513afd
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index 777786c..c80f91a 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -1290,8 +1290,11 @@
// the app image.
klass->SetClassLoader(class_loader.Get());
// The resolved type could be from another dex cache, go through the dex cache just in
- // case.
- klass->SetDexCacheStrings(klass->GetDexCache()->GetStrings());
+ // case. May be null for array classes.
+ if (klass->GetDexCacheStrings() != nullptr) {
+ DCHECK(!klass->IsArrayClass());
+ klass->SetDexCacheStrings(klass->GetDexCache()->GetStrings());
+ }
// If there are multiple dex caches, there may be the same class multiple times
// in different dex caches. Check for this since inserting will add duplicates
// otherwise.