- meth = mono_get_method (m, mtoken, NULL);
- params = custom_attr_params (m, mono_method_signature (meth), mono_metadata_blob_heap (m, cols [MONO_CUSTOM_ATTR_VALUE]));
- fprintf (output, "%d: %s: %s [%s]\n", i, desc, method, params);
+ meth = mono_get_method_checked (m, mtoken, NULL, NULL, &error);
+ if (meth) {
+ params = custom_attr_params (m, mono_method_signature (meth), mono_metadata_blob_heap (m, cols [MONO_CUSTOM_ATTR_VALUE]));
+ fprintf (output, "%d: %s: %s [%s]\n", i, desc, method, params);
+ g_free (params);
+ } else {
+ fprintf (output, "Could not decode method due to %s", mono_error_get_message (&error));
+ mono_error_cleanup (&error);
+ }
+