Skip to content

Commit

Permalink
Check type before calling mrb_range_ptr.
Browse files Browse the repository at this point in the history
  • Loading branch information
clayton-shopify committed Dec 13, 2016
1 parent fead715 commit 73ad739
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/range.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,10 @@ static mrb_bool
range_beg_len(mrb_state *mrb, mrb_value range, mrb_int *begp, mrb_int *lenp, mrb_int len, mrb_bool trunc)
{
mrb_int beg, end;
struct RRange *r = mrb_range_ptr(mrb, range);
struct RRange *r;

if (mrb_type(range) != MRB_TT_RANGE) return FALSE;
r = mrb_range_ptr(mrb, range);

beg = mrb_int(mrb, r->edges->beg);
end = mrb_int(mrb, r->edges->end);
Expand Down

0 comments on commit 73ad739

Please sign in to comment.