From 0ce3151e2db6c7006599bcd79a708d8cfddffae2 Mon Sep 17 00:00:00 2001 From: mertsincan Date: Tue, 2 Aug 2022 10:44:25 +0100 Subject: [PATCH] Added null check --- src/components/autocomplete/AutoComplete.vue | 4 ++-- src/components/dropdown/Dropdown.vue | 4 ++-- src/components/listbox/Listbox.vue | 4 ++-- src/components/multiselect/MultiSelect.vue | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/components/autocomplete/AutoComplete.vue b/src/components/autocomplete/AutoComplete.vue index 23774aab0..34673af12 100755 --- a/src/components/autocomplete/AutoComplete.vue +++ b/src/components/autocomplete/AutoComplete.vue @@ -783,8 +783,8 @@ export default { this.$emit('update:modelValue', value); this.$emit('change', { originalEvent: event, value }); }, - flatOptions(options = []) { - return options.reduce((result, option, index) => { + flatOptions(options) { + return (options || []).reduce((result, option, index) => { result.push({ optionGroup: option, group: true, index }); const optionGroupChildren = this.getOptionGroupChildren(option); diff --git a/src/components/dropdown/Dropdown.vue b/src/components/dropdown/Dropdown.vue index d7065c695..103724de0 100755 --- a/src/components/dropdown/Dropdown.vue +++ b/src/components/dropdown/Dropdown.vue @@ -771,8 +771,8 @@ export default { this.$emit('update:modelValue', value); this.$emit('change', { originalEvent: event, value }); }, - flatOptions(options = []) { - return options.reduce((result, option, index) => { + flatOptions(options) { + return (options || []).reduce((result, option, index) => { result.push({ optionGroup: option, group: true, index }); const optionGroupChildren = this.getOptionGroupChildren(option); diff --git a/src/components/listbox/Listbox.vue b/src/components/listbox/Listbox.vue index f35066c4e..1385e526b 100755 --- a/src/components/listbox/Listbox.vue +++ b/src/components/listbox/Listbox.vue @@ -621,8 +621,8 @@ export default { this.$emit('update:modelValue', value); this.$emit('change', { originalEvent: event, value }); }, - flatOptions(options = []) { - return options.reduce((result, option, index) => { + flatOptions(options) { + return (options || []).reduce((result, option, index) => { result.push({ optionGroup: option, group: true, index }); const optionGroupChildren = this.getOptionGroupChildren(option); diff --git a/src/components/multiselect/MultiSelect.vue b/src/components/multiselect/MultiSelect.vue index 772d48adf..860f72c9e 100755 --- a/src/components/multiselect/MultiSelect.vue +++ b/src/components/multiselect/MultiSelect.vue @@ -901,8 +901,8 @@ export default { this.$emit('update:modelValue', value); this.$emit('change', { originalEvent: event, value }); }, - flatOptions(options = []) { - return options.reduce((result, option, index) => { + flatOptions(options) { + return (options || []).reduce((result, option, index) => { result.push({ optionGroup: option, group: true, index }); const optionGroupChildren = this.getOptionGroupChildren(option);