Check type before calling mrb_range_ptr.

This commit is contained in:
Clayton Smith
2016-12-13 10:04:15 -05:00
parent fead715cef
commit 73ad7395c0
+2 -1
View File
@@ -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);