From: Damyan Ivanov Date: Sat, 30 Jan 2021 21:04:04 +0000 (+0000) Subject: fu: Data.parseNumber X-Git-Tag: v0.17.0~197 X-Git-Url: https://git.ktnx.net/?a=commitdiff_plain;h=65a96105664ccb11f4332e2ddde5758befc7e498;p=mobile-ledger.git fu: Data.parseNumber --- diff --git a/app/src/main/java/net/ktnx/mobileledger/model/Data.java b/app/src/main/java/net/ktnx/mobileledger/model/Data.java index dfd1cd67..c0f4ceba 100644 --- a/app/src/main/java/net/ktnx/mobileledger/model/Data.java +++ b/app/src/main/java/net/ktnx/mobileledger/model/Data.java @@ -232,9 +232,9 @@ public final class Data { public static float parseNumber(String str) throws ParseException { ParsePosition pos = new ParsePosition(0); Number parsed = numberFormatter.parse(str); - if (parsed == null) + if (parsed == null || pos.getErrorIndex() > -1) throw new ParseException("Error parsing '" + str + "'", pos.getErrorIndex()); - return (float) parsed; + return parsed.floatValue(); } } \ No newline at end of file