From c8f04d08e09882fa03e90c10e0894aeb2493bced Mon Sep 17 00:00:00 2001 From: VariableVince <24507472+VariableVince@users.noreply.github.com> Date: Tue, 17 Jun 2025 03:39:13 +0200 Subject: [PATCH] Fix Radial menu undefined params error during spawn phase (#1192) ## Description: During Spawn phase, right clicking on terra nullius opens the Radial menu. But when hovering over where the Info submenu or Build submenu normally are, it results in undefined error. This PR fixes it by checking undefined specifically, and then check null for selected. BEFORE https://github.com/user-attachments/assets/b30f11b8-2324-4d4b-8f70-dd2aaad5a0f5 AFTER https://github.com/user-attachments/assets/252909c5-bb2e-455e-a1a4-faa2f6f00280 ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I process any text displayed to the user through translateText() and I've added it to the en.json file - [x] I have added relevant tests to the test directory - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced - [x] I understand that submitting code with bugs that could have been caught through manual testing blocks releases and new features for all contributors ## Please put your Discord username so you can be contacted if a bug or regression is found: tryout33 --- src/client/graphics/layers/RadialMenuElements.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/client/graphics/layers/RadialMenuElements.ts b/src/client/graphics/layers/RadialMenuElements.ts index 2bcd5d765..61a9d579b 100644 --- a/src/client/graphics/layers/RadialMenuElements.ts +++ b/src/client/graphics/layers/RadialMenuElements.ts @@ -285,7 +285,7 @@ export const infoMenuElement: MenuElement = { color: COLORS.info, subMenu: (params: MenuElementParams) => { - if (!params.selected) return []; + if (params === undefined || params.selected === null) return []; return [ infoChatElement, @@ -310,6 +310,8 @@ export const buildMenuElement: MenuElement = { color: COLORS.build, subMenu: (params: MenuElementParams) => { + if (params === undefined || params.selected === null) return []; + const unitTypes: Set = new Set(); if (params.selected === params.myPlayer) { unitTypes.add(UnitType.City);