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
This commit is contained in:
VariableVince
2025-06-17 03:39:13 +02:00
committed by GitHub
parent 936b43bedc
commit c8f04d08e0
@@ -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<UnitType> = new Set<UnitType>();
if (params.selected === params.myPlayer) {
unitTypes.add(UnitType.City);