OSDN Git Service

Fix null pointer in processing of enum annotations.
authorJeff Hao <jeffhao@google.com>
Fri, 20 Nov 2015 22:56:09 +0000 (14:56 -0800)
committerJeff Hao <jeffhao@google.com>
Fri, 20 Nov 2015 22:56:09 +0000 (14:56 -0800)
Bug: 25802263
Change-Id: Ib20b7049fd3824a5eb3e396d34ef32574771d074

runtime/dex_file.cc

index 70096f5..4163e2e 100644 (file)
@@ -1870,10 +1870,10 @@ bool DexFile::ProcessAnnotationValue(Handle<mirror::Class> klass, const uint8_t*
         Handle<mirror::ClassLoader> class_loader(hs.NewHandle(klass->GetClassLoader()));
         ArtField* enum_field = Runtime::Current()->GetClassLinker()->ResolveField(
             klass->GetDexFile(), index, dex_cache, class_loader, true);
-        Handle<mirror::Class> field_class(hs.NewHandle(enum_field->GetDeclaringClass()));
         if (enum_field == nullptr) {
           return false;
         } else {
+          Handle<mirror::Class> field_class(hs.NewHandle(enum_field->GetDeclaringClass()));
           Runtime::Current()->GetClassLinker()->EnsureInitialized(self, field_class, true, true);
           element_object = enum_field->GetObject(field_class.Get());
           set_object = true;