From fc06a98deec3fa2b173f8ea30a4f4b1781447b19 Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Thu, 10 Oct 2024 20:23:53 -0400
Subject: fixed contextMenu for menus with only a default item

---
 src/client/views/ContextMenu.tsx | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'src/client/views/ContextMenu.tsx')

diff --git a/src/client/views/ContextMenu.tsx b/src/client/views/ContextMenu.tsx
index 2eb3e5565..1931d7c2a 100644
--- a/src/client/views/ContextMenu.tsx
+++ b/src/client/views/ContextMenu.tsx
@@ -254,9 +254,9 @@ export class ContextMenu extends ObservableReactComponent<{ noexpand?: boolean }
                 this._selectedIndex--;
             }
             e.preventDefault();
-        } else if ((e.key === 'Enter' || e.key === 'Tab') && this._selectedIndex >= 0) {
+        } else if (e.key === 'Enter' || e.key === 'Tab') {
             const item = this.flatItems[this._selectedIndex];
-            if (item.event) {
+            if (item?.event) {
                 item.event({ x: this.pageX, y: this.pageY });
             } else {
                 // if (this._searchString.startsWith(this._defaultPrefix)) {
-- 
cgit v1.2.3-70-g09d2

