Author: zoltan
Date: 2006-10-06 11:32:11 -0400 (Fri, 06 Oct 2006)
New Revision: 66360

Modified:
   trunk/mono/mono/metadata/ChangeLog
   trunk/mono/mono/metadata/reflection.c
Log:
2006-10-06  Zoltan Varga  <[EMAIL PROTECTED]>

        * reflection.c (mono_module_get_object): Avoid an assert when operating 
on
        modules with no metadata. Fixes #79596.


Modified: trunk/mono/mono/metadata/ChangeLog
===================================================================
--- trunk/mono/mono/metadata/ChangeLog  2006-10-06 15:28:41 UTC (rev 66359)
+++ trunk/mono/mono/metadata/ChangeLog  2006-10-06 15:32:11 UTC (rev 66360)
@@ -1,5 +1,8 @@
 2006-10-06  Zoltan Varga  <[EMAIL PROTECTED]>
 
+       * reflection.c (mono_module_get_object): Avoid an assert when operating 
on
+       modules with no metadata. Fixes #79596.
+
        * image.c (load_metadata_ptrs): Put back the error message when
        the #- heap is encountered since the support is not complete yet.
 

Modified: trunk/mono/mono/metadata/reflection.c
===================================================================
--- trunk/mono/mono/metadata/reflection.c       2006-10-06 15:28:41 UTC (rev 
66359)
+++ trunk/mono/mono/metadata/reflection.c       2006-10-06 15:32:11 UTC (rev 
66360)
@@ -5300,13 +5300,14 @@
                res->token = mono_metadata_make_token (MONO_TABLE_MODULE, 1);
        } else {
                int i;
-               g_assert (image->assembly->image->modules);
                res->token = 0;
-               for (i = 0; i < image->assembly->image->module_count; i++) {
-                       if (image->assembly->image->modules [i] == image)
-                               res->token = mono_metadata_make_token 
(MONO_TABLE_MODULEREF, i + 1);
+               if (image->assembly->image->modules) {
+                       for (i = 0; i < image->assembly->image->module_count; 
i++) {
+                               if (image->assembly->image->modules [i] == 
image)
+                                       res->token = mono_metadata_make_token 
(MONO_TABLE_MODULEREF, i + 1);
+                       }
+                       g_assert (res->token);
                }
-               g_assert (res->token);
        }
 
        CACHE_OBJECT (MonoReflectionModule *, image, res, NULL);

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to