Skip to content

Commit

Permalink
fix: prevent null in street name (#1521)
Browse files Browse the repository at this point in the history
  • Loading branch information
huextrat authored Sep 28, 2023
1 parent fb1397b commit 99e9c60
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,12 @@ internal fun mapFromShippingContact(googlePayResult: GooglePayResult): WritableM
postalAddress.putString("country", googlePayResult.shippingInformation?.address?.country)
postalAddress.putString("postalCode", googlePayResult.shippingInformation?.address?.postalCode)
postalAddress.putString("state", googlePayResult.shippingInformation?.address?.state)
postalAddress.putString("street", googlePayResult.shippingInformation?.address?.line1 + "\n" + googlePayResult.shippingInformation?.address?.line2)
val line1: String? = googlePayResult.shippingInformation?.address?.line1
val line2: String? = googlePayResult.shippingInformation?.address?.line2
val street =
(if (line1 != null) "$line1" else "") +
(if (line2 != null) "\n$line2" else "")
postalAddress.putString("street", street)
postalAddress.putString("isoCountryCode", googlePayResult.shippingInformation?.address?.country)
map.putMap("postalAddress", postalAddress)
return map
Expand Down

0 comments on commit 99e9c60

Please sign in to comment.