From a99d517d855f23f79a449b91b8f6a519e0b0672e Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Tue, 28 May 2019 18:38:42 -0700 Subject: [PATCH] Add null checks before calling ClassLoader::EnsureLoaded (dotnet/coreclr#24818) Fixes dotnet/coreclr#24816 Commit migrated from https://github.com/dotnet/coreclr/commit/02e75ab55272902aed4c2501ab7c6740bae30485 --- src/coreclr/src/vm/fieldmarshaler.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/coreclr/src/vm/fieldmarshaler.h b/src/coreclr/src/vm/fieldmarshaler.h index 1718bd3..7041cf1 100644 --- a/src/coreclr/src/vm/fieldmarshaler.h +++ b/src/coreclr/src/vm/fieldmarshaler.h @@ -447,7 +447,9 @@ protected: Module::RestoreMethodTablePointer(ppMT); #else // FEATURE_PREJIT // without NGEN we only have to make sure that the type is fully loaded - ClassLoader::EnsureLoaded(ppMT->GetValue()); + MethodTable* pMT = ppMT->GetValue(); + if (pMT != NULL) + ClassLoader::EnsureLoaded(pMT); #endif // FEATURE_PREJIT } @@ -1094,7 +1096,9 @@ public: Module::RestoreTypeHandlePointer(&m_arrayType); #else // FEATURE_PREJIT // without NGEN we only have to make sure that the type is fully loaded - ClassLoader::EnsureLoaded(m_arrayType.GetValue()); + TypeHandle th = m_arrayType.GetValue(); + if (!th.IsNull()) + ClassLoader::EnsureLoaded(th); #endif // FEATURE_PREJIT FieldMarshaler::RestoreImpl(); } -- 2.7.4