Skip to content

Commit

Permalink
mrb: Context#[] accepts nil
Browse files Browse the repository at this point in the history
nil is returned for nil input.
  • Loading branch information
kou committed Feb 23, 2015
1 parent fc129c8 commit 277484c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/mrb/mrb_ctx.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ ctx_array_reference(mrb_state *mrb, mrb_value self)

mrb_get_args(mrb, "o", &mrb_id_or_name);

if (mrb_nil_p(mrb_id_or_name)) {
return mrb_nil_value();
}

if (mrb_fixnum_p(mrb_id_or_name)) {
grn_id id = mrb_fixnum(mrb_id_or_name);
object = grn_ctx_at(ctx, id);
Expand Down

0 comments on commit 277484c

Please sign in to comment.