hotfix cursor selection

This commit is contained in:
Frederico Santos 2024-08-02 19:20:17 +01:00
parent 3a87c8657f
commit 0d406b1092
1 changed files with 9 additions and 5 deletions

View File

@ -331,11 +331,15 @@ export default class MenuUiHandler extends MessageUiHandler {
if (button === Button.ACTION) { if (button === Button.ACTION) {
let adjustedCursor = this.cursor; let adjustedCursor = this.cursor;
for (const imo of this.excludedMenus().find(e => e.condition).options.sort()) { const excludedMenu = this.excludedMenus().find(e => e.condition);
if (adjustedCursor >= imo) { if (excludedMenu !== null && excludedMenu.options.length > 0) {
adjustedCursor++; const sortedOptions = excludedMenu.options.sort();
} else { for (const imo of sortedOptions) {
break; if (adjustedCursor >= imo) {
adjustedCursor++;
} else {
break;
}
} }
} }
switch (adjustedCursor) { switch (adjustedCursor) {