Back out trivial crash when running metadata checked-build mode
authorAndi McClure <andi.mcclure@xamarin.com>
Wed, 21 Sep 2016 21:52:51 +0000 (17:52 -0400)
committerAndi McClure <andi.mcclure@xamarin.com>
Wed, 21 Sep 2016 21:52:51 +0000 (17:52 -0400)
introduced by f822445711c1

mono/utils/checked-build.c

index 82ce187e9c874058f1d4c5c732764d5c8fb7b3e1..aa6c407c40206735eef591f596eb3d6ef8bd2638 100644 (file)
@@ -486,7 +486,12 @@ check_image_may_reference_image(MonoImage *from, MonoImage *to)
 
                        for (inner_idx = 0; !success && inner_idx < checking->nreferences; inner_idx++)
                        {
-                               CHECK_IMAGE_VISIT (checking->references[inner_idx]->image);
+                               // Assembly references are lazy-loaded and thus allowed to be NULL.
+                               // If they are NULL, we don't care about them for this search, because their images haven't impacted ref_count yet.
+                               if (checking->references[inner_idx])
+                               {
+                                       CHECK_IMAGE_VISIT (checking->references[inner_idx]->image);
+                               }
                        }
 
                        mono_image_unlock (checking);