mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-07-04 04:55:16 +01:00
Prevent crash when parsing an invalid custom donation amount.
This commit is contained in:
+3
@@ -42,6 +42,7 @@ import org.whispersystems.signalservice.api.subscriptions.SubscriberId
|
||||
import java.math.BigDecimal
|
||||
import java.text.DecimalFormat
|
||||
import java.text.DecimalFormatSymbols
|
||||
import java.text.ParseException
|
||||
import java.util.Currency
|
||||
import java.util.Optional
|
||||
|
||||
@@ -170,6 +171,8 @@ class DonateToSignalViewModel(
|
||||
decimalFormat.parse(amount) as BigDecimal
|
||||
} catch (e: NumberFormatException) {
|
||||
BigDecimal.ZERO
|
||||
} catch (e: ParseException) {
|
||||
BigDecimal.ZERO
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user