Merge pull request #67 from mattn/fix_null_deref

Avoid to crash when "mruby -e p"
This commit is contained in:
Yukihiro "Matz" Matsumoto
2012-04-27 03:17:46 -07:00
+2 -2
View File
@@ -42,14 +42,14 @@ static mrb_value
p_m(mrb_state *mrb, mrb_value self)
{
int argc, i;
mrb_value *argv;
mrb_value *argv = NULL;
mrb_get_args(mrb, "*", &argv, &argc);
for (i=0; i<argc; i++) {
mrb_p(mrb, argv[i]);
}
return argv[0];
return argv ? argv[0] : mrb_nil_value();
}
mrb_value