From ad8284bac680c191f66c2b5b053ba0e73c45072d Mon Sep 17 00:00:00 2001 From: Tucker Polomik Date: Sun, 4 Oct 2020 15:35:11 -0700 Subject: [PATCH] AK: check fractional string has_value() in JsonParser Resolves #3670 --- AK/JsonParser.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 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;