Merge pull request #2524 from lambdageek/monoerror-mono_string_new_utf16_checked
[mono.git] / mono / utils / mono-error.c
index 5673719059b0f182f4472aa37a4769d79dff2851..768b169079f4b8f4a95dde7d593621761818333c 100644 (file)
@@ -481,6 +481,18 @@ mono_error_set_argument (MonoError *oerror, const char *argument, const char *ms
        set_error_message ();
 }
 
+void
+mono_error_set_argument_null (MonoError *oerror, const char *argument, const char *msg_format, ...)
+{
+       MonoErrorInternal *error = (MonoErrorInternal*)oerror;
+       mono_error_prepare (error);
+
+       error->error_code = MONO_ERROR_ARGUMENT_NULL;
+       error->first_argument = argument;
+
+       set_error_message ();
+}
+
 void
 mono_error_set_not_verifiable (MonoError *oerror, MonoMethod *method, const char *msg_format, ...)
 {
@@ -645,6 +657,10 @@ mono_error_prepare_exception (MonoError *oerror, MonoError *error_out)
                exception = mono_get_exception_argument (error->first_argument, error->full_message);
                break;
 
+       case MONO_ERROR_ARGUMENT_NULL:
+               exception = mono_get_exception_argument_null (error->first_argument);
+               break;
+
        case MONO_ERROR_NOT_VERIFIABLE: {
                char *type_name = NULL, *message;
                if (error->exn.klass) {