Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[SDK audit] Recommendation: Don’t silently treat null Double? values as 0.0 #1454

Open
HonzaR opened this issue Apr 23, 2024 · 0 comments
Open

Comments

@HonzaR
Copy link
Contributor

HonzaR commented Apr 23, 2024

Is your feature request related to a problem? Please describe.

The following code from CurrencyFormatter.kt, used to convert a Double? value to a BigDecimal
silently converts the value null to 0.0.

Describe the solution you'd like

The value null could indicate that some error occurred in acquiring the value being converted, and so it would be safer to throw an exception in the null case, rather than assume null represents the value 0.0.
The same pattern exists in several other functions in CurrencyFormatter.kt.

Alternatives you've considered

Additional context

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

1 participant