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) {
let adjustedCursor = this.cursor;
for (const imo of this.excludedMenus().find(e => e.condition).options.sort()) {
if (adjustedCursor >= imo) {
adjustedCursor++;
} else {
break;
const excludedMenu = this.excludedMenus().find(e => e.condition);
if (excludedMenu !== null && excludedMenu.options.length > 0) {
const sortedOptions = excludedMenu.options.sort();
for (const imo of sortedOptions) {
if (adjustedCursor >= imo) {
adjustedCursor++;
} else {
break;
}
}
}
switch (adjustedCursor) {