From 4b45450879528c34c7670d9b84fc0a871df1b96f Mon Sep 17 00:00:00 2001 From: SmileyDoodle <64726751+SmileyDoodle@users.noreply.github.com> Date: Wed, 3 Mar 2021 13:42:12 +0200 Subject: [PATCH] Add this.countriesSorted[index].iso2 condition Hei, we are using your library. Recently, we got a report regarding line 255 -> "TypeError: Cannot read property 'iso2' of undefined". We fixed it adding an extra condition in that line. Submitting a MR for your consideration. Thank you. --- src/VuePhoneNumberInput/CountrySelector/index.vue | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/VuePhoneNumberInput/CountrySelector/index.vue b/src/VuePhoneNumberInput/CountrySelector/index.vue index 949636d..7329f05 100644 --- a/src/VuePhoneNumberInput/CountrySelector/index.vue +++ b/src/VuePhoneNumberInput/CountrySelector/index.vue @@ -252,7 +252,9 @@ ? this.countriesSorted.length - 1 : 0 } - this.tmpValue = this.countriesSorted[index].iso2 + if (this.countriesSorted[index]) { + this.tmpValue = this.countriesSorted[index].iso2; + } this.scrollToSelectedOnFocus(index) } else if (code === 13) { // enter