From b9a9cd611b01c3b0da4ab7b2a4505f2a82749917 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Thu, 4 Feb 2021 15:57:21 +0100 Subject: [PATCH] Fixes #3391 - Unable to open object manager select field modal if options contains invalid data (like undefined or null). --- .../_ui_element/object_manager_attribute.coffee | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/app/controllers/_ui_element/object_manager_attribute.coffee b/app/assets/javascripts/app/controllers/_ui_element/object_manager_attribute.coffee index 04358f42c..8f19f3dc7 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/object_manager_attribute.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/object_manager_attribute.coffee @@ -8,7 +8,12 @@ class App.UiElement.object_manager_attribute extends App.UiElement.ApplicationUi params.data_option = params.data_option_new if attribute.value == 'select' && params.data_option? && params.data_option.options? - sorted = _.map params.data_option.options, (value, key) -> [key.toString(), value.toString()] + sorted = _.map( + params.data_option.options, (value, key) -> + key = '' if !key || !key.toString + value = '' if !value || !value.toString + [key.toString(), value.toString()] + ) params.data_option.sorted = sorted.sort( (a, b) -> a[1].localeCompare(b[1]) ) item = $(App.view('object_manager/attribute')(attribute: attribute))