Skip to content

Commit

Permalink
Check intern object returned by mrb_check_string_type
Browse files Browse the repository at this point in the history
  • Loading branch information
ksss committed Jan 6, 2017
1 parent 158a6ab commit ddcb30d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/kernel.c
Original file line number Diff line number Diff line change
Expand Up @@ -965,14 +965,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;
}
Expand Down

0 comments on commit ddcb30d

Please sign in to comment.