hbb20 / hbb20/CountryCodePickerProject
NPE at !detectedCountry.equals(selectedCountry)
- Lingua principale
- Java
- Stelle
- 1.5k
- Fork
- 509
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
`detectedCountry` can be null. But in line `!detectedCountry.equals(selectedCountry)` we use it
```java
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
CCPCountry selectedCountry = getSelectedCountry();
if (selectedCountry != null && (lastCheckedNumber == null || !lastCheckedNumber.equals(s.toString())) && countryDetectionBasedOnAreaAllowed) {
//possible countries
if (currentCountryGroup != null) {
String enteredValue = getEditText_registeredCarrierNumber().getText().toString();
if (enteredValue.length() >= currentCountryGroup.areaCodeLength) {
String digitsValue = PhoneNumberUtil.normalizeDigitsOnly(enteredValue);
if (digitsValue.length() >= currentCountryGroup.areaCodeLength) {
String currentAreaCode = digitsValue.substring(0, currentCountryGroup.areaCodeLength);
if (!currentAreaCode.equals(lastCheckedAreaCode)) {
CCPCountry detectedCountry = currentCountryGroup.getCountryForAreaCode(context, getLanguageToApply(), currentAreaCode);
if (!detectedCountry.equals(selectedCountry)) {
countryChangedDueToAreaCode = true;
lastCursorPosition = Selection.getSelectionEnd(s);
setSelectedCountry(detectedCountry);
}
lastCheckedAreaCode = currentAreaCode;
}
}
}
}
lastCheckedNumber = s.toString();
}
}
```
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Valutazione
Questa issue non è ancora stata valutata.