hbb20 / hbb20/CountryCodePickerProject
NPE at !detectedCountry.equals(selectedCountry)
- Vorherrschende Sprache
- Java
- Sterne
- 1.5k
- Forks
- 509
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
`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();
}
}
```
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Bewertung
Dieses Issue wurde noch nicht bewertet.