Skip to content

Conversation

@jeffdgr8
Copy link

@jeffdgr8 jeffdgr8 commented May 31, 2020

It's possible for StandardAddressVerifier.verifyFields() to crash with:

Fatal Exception: java.lang.NullPointerException: Cannot use null as key
       at com.google.i18n.addressinput.common.Util.checkNotNull(Util.java:123)
       at com.google.i18n.addressinput.common.FieldVerifier.isCountryKey(FieldVerifier.java:439)
       at com.google.i18n.addressinput.common.FieldVerifier.populate(FieldVerifier.java:171)
       at com.google.i18n.addressinput.common.FieldVerifier.<init>(FieldVerifier.java:105)
       at com.google.i18n.addressinput.common.FieldVerifier.refineVerifier(FieldVerifier.java:283)
       at com.google.i18n.addressinput.common.StandardAddressVerifier$Verifier.run(StandardAddressVerifier.java:132)
       at com.google.i18n.addressinput.common.StandardAddressVerifier.verifyFields(StandardAddressVerifier.java:86)

This happens if ClientData.fetchDataIfNotAvailable() fails to fetch data from the server in CacheData.fetchDynamicData(), resulting in getting the data from the RegionDataConstants with CacheData.getFromRegionDataConstants(). The constants data lacks the id key values that are returned from the server, which are required by FieldVerifier.isCountryKey().

This change fixes this by adding the id value for region constant data from its LookupKey.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant