2006-05-27 Miguel de Icaza <miguel@novell.com>
+ * class.c (mono_class_from_typeref): handle missing images
+ earlier, deals with bug #78418. Refactor code;
+
+ Fix a warning introduced in my previous commit (some stale code
+ from before I revisited my patch).
+
* class.c (mono_class_create_from_typedef): On failure, remove the
class from the MonoImage->class_cache as the class is not
initialized; Fixes the leak pointed out by Paolo.
/* a typedef in disguise */
return mono_class_from_name (image, nspace, name);
case MONO_RESOLTION_SCOPE_MODULEREF:
- return mono_class_from_name (image->modules [idx - 1], nspace, name);
+ if (image->modules [idx-1])
+ return mono_class_from_name (image->modules [idx - 1], nspace, name);
+ else {
+ char *msg = g_strdup_printf ("%s%s%s", nspace, nspace [0] ? "." : "", name);
+ char *human_name;
+
+ human_name = mono_stringify_assembly_name (&image->assembly->aname);
+ mono_loader_set_error_type_load (msg, human_name);
+ g_free (msg);
+ g_free (human_name);
+
+ return NULL;
+ }
case MONO_RESOLTION_SCOPE_TYPEREF: {
MonoClass *enclosing = mono_class_from_typeref (image, MONO_TOKEN_TYPE_REF | idx);
GList *tmp;
mono_loader_unlock ();
- return ok;
+ return;
}
/*