Permalink
Browse files

raise ArgumentError on nil

  • Loading branch information...
1 parent 475e6cf commit 90a88631ef3da0c820adb7779dab27c723f8caba @Watson1978 Watson1978 committed Jan 10, 2012
Showing with 1 addition and 2 deletions.
  1. +1 −2 random.c
View
@@ -683,15 +683,14 @@ random_rand(VALUE obj, SEL sel, int argc, VALUE *argv)
int excl = 0;
if (argc == 0) {
-zero_arg:
return rb_float_new(genrand_real(&rnd->mt));
}
else if (argc != 1) {
rb_raise(rb_eArgError, "wrong number of arguments (%d for 0..1)", argc);
}
VALUE vmax = argv[0];
if (NIL_P(vmax)) {
- goto zero_arg;
+ v = Qnil;
}
else if (TYPE(vmax) != T_FLOAT
&& (v = rb_check_to_integer(vmax, "to_int"), !NIL_P(v))) {

0 comments on commit 90a8863

Please sign in to comment.