summaryrefslogtreecommitdiff
path: root/AK/JsonParser.cpp
diff options
context:
space:
mode:
authorTucker Polomik <tuckerpo@buffalo.edu>2020-10-04 15:35:11 -0700
committerAndreas Kling <kling@serenityos.org>2020-10-06 14:27:51 +0200
commitad8284bac680c191f66c2b5b053ba0e73c45072d (patch)
tree5045909942213f3d02908d95c7f0edc7dab45bc5 /AK/JsonParser.cpp
parentbe693e95ff39cf580ce8659c94acb26cb94ef138 (diff)
downloadserenity-ad8284bac680c191f66c2b5b053ba0e73c45072d.zip
AK: check fractional string has_value() in JsonParser
Resolves #3670
Diffstat (limited to 'AK/JsonParser.cpp')
-rw-r--r--AK/JsonParser.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/AK/JsonParser.cpp b/AK/JsonParser.cpp
index 2e177ee7f7..8ba3987873 100644
--- a/AK/JsonParser.cpp
+++ b/AK/JsonParser.cpp
@@ -212,7 +212,10 @@ Optional<JsonValue> JsonParser::parse_number()
whole = number.value();
}
- int fraction = fraction_string.to_uint().value();
+ auto fraction_string_uint = fraction_string.to_uint();
+ if (!fraction_string_uint.has_value())
+ return {};
+ int fraction = fraction_string_uint.value();
fraction *= (whole < 0) ? -1 : 1;
auto divider = 1;