Skip to content

Improve listitem validation #866

Closed
Closed

Description

@NexiusTailer

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions