Commit d3f665c4 authored by Dominik Charousset's avatar Dominik Charousset

Fix minor issues in the JSON reader

parent cfeb9105
......@@ -11,6 +11,9 @@ is based on [Keep a Changelog](https://keepachangelog.com).
heap-use-after-free if the actor terminates before the action runs. The
destructor of the promise now checks for this case.
- Accessing URI fields now always returns the normalized string.
- The JSON parser no longer chokes when encountering `null` as last value before
the closing parenthesis.
- The JSON reader now automatically widens integers to doubles as necessary.
### Changed
......
......@@ -128,7 +128,7 @@ void read_json_null_or_nan(string_parser_state& ps, Consumer consumer) {
transition(done, 'n', res_type = is_nan)
}
term_state(done) {
transition(init, " \t\n")
transition(done, " \t\n")
}
fin();
// clang-format on
......
......@@ -568,6 +568,9 @@ bool json_reader::value(double& x) {
if (val.data.index() == detail::json::value::double_index) {
x = std::get<double>(val.data);
return true;
} else if (val.data.index() == detail::json::value::integer_index) {
x = std::get<int64_t>(val.data);
return true;
} else {
emplace_error(sec::runtime_error, class_name, fn, current_field_name(),
type_clash("json::real", val));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment