Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve listitem validation #866

Open
NexiusTailer opened this issue Feb 14, 2024 · 0 comments
Open

Improve listitem validation #866

NexiusTailer opened this issue Feb 14, 2024 · 0 comments

Comments

@NexiusTailer
Copy link
Contributor

NexiusTailer commented Feb 14, 2024

Now listitems in dialogs are validated this way:

// If dialog type is one of the lists and list item is invalid, ignore it
if (sendDialogResponse.ListItem < 0 && (data->style_ == DialogStyle_LIST || data->style_ == DialogStyle_TABLIST || data->style_ == DialogStyle_TABLIST_HEADERS))
{
return false;
}

but it should also consider any other dialog styles (DIALOG_STYLE_MSGBOX, DIALOG_STYLE_INPUT and DIALOG_STYLE_PASSWORD) where listitem always -1 only, and any other values are inacceptable.

The ideal way of validating listitems would be remembering how much items the shown dialog actually has for a player (counting it when ShowPlayerDialog was called, as an example) and clearly check if the listitem is in the range of 0..[max listitem value] for dialogs with any tablist style; Otherwise check if the listitem is not -1 for any other dialog styles.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant