Skip to content

Commit ff99de6

Browse files
authored
Fix error when clearing by null value (#391)
1 parent 6892f59 commit ff99de6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ class PhoneInput extends React.Component {
554554
// we don't need to send the whole number to guess the country... only the first 6 characters are enough
555555
// the guess country function can then use memoization much more effectively since the set of input it
556556
// gets has drastically reduced
557-
if (!this.state.freezeSelection || selectedCountry.dialCode.length > inputNumber.length) {
557+
if (!this.state.freezeSelection || (!!selectedCountry && selectedCountry.dialCode.length > inputNumber.length)) {
558558
if (this.props.disableCountryGuess) {newSelectedCountry = selectedCountry;}
559559
else {
560560
newSelectedCountry = this.guessSelectedCountry(inputNumber.substring(0, 6), country, onlyCountries, hiddenAreaCodes) || selectedCountry;

0 commit comments

Comments
 (0)