diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2016-01-18 12:24:25 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2016-01-21 03:31:08 +0900 |
| commit | 8a74e68552a9a791de0202fff197095bd308e0eb (patch) | |
| tree | f4a5c4fd848c3d51850522e153d264cb13aa2892 /mrbgems/mruby-random/src/random.c | |
| parent | 8d78c49e9af9bae681f1367cf3a035de865deb48 (diff) | |
| download | mruby-8a74e68552a9a791de0202fff197095bd308e0eb.tar.gz mruby-8a74e68552a9a791de0202fff197095bd308e0eb.zip | |
mruby-random: fixed wrong fixnum conversion
Diffstat (limited to 'mrbgems/mruby-random/src/random.c')
| -rw-r--r-- | mrbgems/mruby-random/src/random.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/mrbgems/mruby-random/src/random.c b/mrbgems/mruby-random/src/random.c index 040d83ed6..3b8d0dd2f 100644 --- a/mrbgems/mruby-random/src/random.c +++ b/mrbgems/mruby-random/src/random.c @@ -79,10 +79,10 @@ get_opt(mrb_state* mrb) mrb_get_args(mrb, "|o", &arg); if (!mrb_nil_p(arg)) { - if (!mrb_fixnum_p(arg)) { + arg = mrb_check_convert_type(mrb, arg, MRB_TT_FIXNUM, "Fixnum", "to_int"); + if (mrb_nil_p(arg)) { mrb_raise(mrb, E_ARGUMENT_ERROR, "invalid argument type"); } - arg = mrb_check_convert_type(mrb, arg, MRB_TT_FIXNUM, "Fixnum", "to_int"); if (mrb_fixnum(arg) < 0) { arg = mrb_fixnum_value(0 - mrb_fixnum(arg)); } |
