From e97b30dae06758dc9381b551cea91d22bc7b2d08 Mon Sep 17 00:00:00 2001 From: "Hung-Han (Henry) Chen" Date: Thu, 20 May 2021 13:09:16 +0300 Subject: [PATCH] Check if name is undefined Signed-off-by: Hung-Han (Henry) Chen --- src/renderer/components/hotbar/hotbar-icon.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/renderer/components/hotbar/hotbar-icon.tsx b/src/renderer/components/hotbar/hotbar-icon.tsx index bdd00859c2..d5d68c7c83 100644 --- a/src/renderer/components/hotbar/hotbar-icon.tsx +++ b/src/renderer/components/hotbar/hotbar-icon.tsx @@ -67,7 +67,10 @@ function onMenuItemClick(menuItem: CatalogEntityContextMenu) { } } -function getNameParts(name: string): string[] { +function getNameParts(name?: string) { + if (!name) { + return []; + } const byWhitespace = name.split(/\s+/); if (byWhitespace.length > 1) {