Skip to content

Commit

Permalink
Fix 'Invalid float' error
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonpenny committed Aug 29, 2023
1 parent 5924c9e commit a596110
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ext/oj/parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,11 @@ oj_num_as_value(NumInfo ni) {
double d = strtod(ni->str, &end);

if ((long)ni->len != (long)(end - ni->str)) {
if (Qnil == ni->pi->err_class) {
rb_raise(oj_parse_error_class, "Invalid float");
} else {
rb_raise(ni->pi->err_class, "Invalid float");
}
}
rnum = rb_float_new(d);
}
Expand Down

0 comments on commit a596110

Please sign in to comment.