Skip to content

Commit

Permalink
fix: null amount causing app crash
Browse files Browse the repository at this point in the history
  • Loading branch information
AbrahamOsmondE authored and therajanmaurya committed Apr 7, 2024
1 parent 6bece26 commit b998bf4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/src/main/java/org/mifos/mobile/utils/CurrencyUtil.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ object CurrencyUtil {

private val defaultLocale = Locale.US
fun formatCurrency(context: Context, amt: String?): String {
return getDecimalFormatter(context).format(amt)
return getDecimalFormatter(context).format(amt ?: "0.0")
}

fun formatCurrency(context: Context, amt: Long): String {
Expand All @@ -21,7 +21,7 @@ object CurrencyUtil {

@JvmStatic
fun formatCurrency(context: Context?, amt: Double?): String {
return getDecimalFormatter(context).format(amt)
return getDecimalFormatter(context).format(amt ?: 0.0)
}

private fun getDecimalFormatter(context: Context?): DecimalFormat {
Expand Down

0 comments on commit b998bf4

Please sign in to comment.