From 67b763a901e88b315b3de84581a74d4ea8ace17c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrik=20tom=20W=C3=B6rden?= <h.tomwoerden@indiscale.com>
Date: Tue, 10 Oct 2023 11:51:03 +0200
Subject: [PATCH] FIX: deal with empty options list

---
 src/core/js/edit_mode.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/core/js/edit_mode.js b/src/core/js/edit_mode.js
index 4659f92c..d2b8fbcf 100644
--- a/src/core/js/edit_mode.js
+++ b/src/core/js/edit_mode.js
@@ -1024,7 +1024,7 @@ var edit_mode = new function () {
                     result.empty();
                     result.append(select);
                     // value=NA means that the first element is the warning that not all entities are provided
-                    if (_options[0].getAttribute('value') == "NA") {
+                    if (_options.length > 0 && _options[0].getAttribute('value') == "NA") {
                         // The button to show the input field for manual ID insertion
                         var manualInsertButton = $('<button title="Insert Entity Id manually." class="btn btn-link caosdb-update-entity-button caosdb-f-list-item-button"><i class="bi-pencil"></i></button>');
                         $(manualInsertButton).click(function () {
-- 
GitLab