From 65a96105664ccb11f4332e2ddde5758befc7e498 Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Sat, 30 Jan 2021 21:04:04 +0000 Subject: [PATCH] fu: Data.parseNumber --- app/src/main/java/net/ktnx/mobileledger/model/Data.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 -- 2.39.5