Commit 0803a2e2 authored by mattn's avatar mattn

Avoid to crash when "mruby -e p"

parent ee30c5a4
...@@ -42,14 +42,14 @@ static mrb_value ...@@ -42,14 +42,14 @@ static mrb_value
p_m(mrb_state *mrb, mrb_value self) p_m(mrb_state *mrb, mrb_value self)
{ {
int argc, i; int argc, i;
mrb_value *argv; mrb_value *argv = NULL;
mrb_get_args(mrb, "*", &argv, &argc); mrb_get_args(mrb, "*", &argv, &argc);
for (i=0; i<argc; i++) { for (i=0; i<argc; i++) {
mrb_p(mrb, argv[i]); mrb_p(mrb, argv[i]);
} }
return argv[0]; return argv ? argv[0] : mrb_nil_value();
} }
mrb_value mrb_value
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment