blongho / worldCountryData

Android library for country flag, currency, and other country information
https://blongho.github.io/worldCountryData/doc/
MIT License
98 stars 35 forks source link

String.toLowerCase()' on a null object reference com.blongho.country_data.WorldData.getCurrencies #21

Closed chitgoks closed 3 years ago

chitgoks commented 3 years ago

Caused by java.lang.NullPointerException Attempt to invoke virtual method 'java.lang.String java.lang.String.toLowerCase()' on a null object reference com.blongho.country_data.WorldData.getCurrencies (WorldData.java:31)

I reported this based on getCurrencies() i didnt use this method so problem could be inside. perhaps a check if string is null?

blongho commented 3 years ago

I have checked and it seems some countries lack currency and some lack currency symbol. Controll for non-null on these before working on them.

This issue is addressed in the soon to be released version.

blongho commented 3 years ago

You can check my implementation here and see how i checked for null https://github.com/blongho/world-country-data-demo/blob/master/app/src/main/java/com/blongho/countrydata/viewmodel/CountryRepository.java#L67