diff options
author | 2016-04-12 16:54:48 -0700 | |
---|---|---|
committer | 2016-04-12 17:59:44 -0700 | |
commit | 6d25cf6cbda1b95fb014a3fd22c01a6bdf47725e (patch) | |
tree | d718c92777b01053a47c14a891a6d8dd493d0821 /runtime/class_linker.cc | |
parent | 780b46126af0b4239ff5a3a88f347548d960bbe4 (diff) |
Fix InsertDexFileInToClassLoader to handle null class loaders
Maybe used by legacy apps. This functionality is planned for
deprecation.
Bug: 27954959
(cherry picked from commit f2bf9d640e37b72be8b4f6016d4aa95a0e27b7b4)
Change-Id: I1ae2cf1e33f2f1b237a41c8cc50d2a814a52a95a
Diffstat (limited to 'runtime/class_linker.cc')
-rw-r--r-- | runtime/class_linker.cc | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc index 18def2df2e..1e7ee65eac 100644 --- a/runtime/class_linker.cc +++ b/runtime/class_linker.cc @@ -7760,12 +7760,11 @@ void ClassLinker::VisitClassLoaders(ClassLoaderVisitor* visitor) const { void ClassLinker::InsertDexFileInToClassLoader(mirror::Object* dex_file, mirror::ClassLoader* class_loader) { DCHECK(dex_file != nullptr); - DCHECK(class_loader != nullptr); Thread* const self = Thread::Current(); WriterMutexLock mu(self, *Locks::classlinker_classes_lock_); - ClassTable* const table = class_loader->GetClassTable(); + ClassTable* const table = ClassTableForClassLoader(class_loader); DCHECK(table != nullptr); - if (table->InsertDexFile(dex_file)) { + if (table->InsertDexFile(dex_file) && class_loader != nullptr) { // It was not already inserted, perform the write barrier to let the GC know the class loader's // class table was modified. Runtime::Current()->GetHeap()->WriteBarrierEveryFieldOf(class_loader); |