the argument for Exception.new is optinal

This commit is contained in:
Yukihiro Matsumoto
2012-05-31 11:15:51 +09:00
parent e3c1b48ba2
commit fae483ff2a
+3 -3
View File
@@ -56,9 +56,9 @@ exc_initialize(mrb_state *mrb, mrb_value exc)
{
mrb_value mesg;
mrb_get_args(mrb, "o", &mesg);
mrb_iv_set(mrb, exc, mrb_intern(mrb, "mesg"), mesg);
if (mrb_get_args(mrb, "|o", &mesg) == 1) {
mrb_iv_set(mrb, exc, mrb_intern(mrb, "mesg"), mesg);
}
return exc;
}