Merge pull request #3377 from ksss/respond_to

Check intern object returned by mrb_check_string_type
This commit is contained in:
Yukihiro "Matz" Matsumoto
2017-01-06 18:56:39 +09:00
committed by GitHub
+5 -2
View File
@@ -988,14 +988,17 @@ obj_respond_to(mrb_state *mrb, mrb_value self)
}
else {
mrb_value tmp;
if (!mrb_string_p(mid)) {
if (mrb_string_p(mid)) {
tmp = mrb_check_intern_str(mrb, mid);
}
else {
tmp = mrb_check_string_type(mrb, mid);
if (mrb_nil_p(tmp)) {
tmp = mrb_inspect(mrb, mid);
mrb_raisef(mrb, E_TYPE_ERROR, "%S is not a symbol", tmp);
}
tmp = mrb_check_intern_str(mrb, tmp);
}
tmp = mrb_check_intern_str(mrb, mid);
if (mrb_nil_p(tmp)) {
respond_to_p = FALSE;
}