open.mp icon indicating copy to clipboard operation
open.mp copied to clipboard

Improve listitem validation

Open NexiusTailer opened this issue 5 months ago • 0 comments

Now listitems in dialogs are validated this way:

https://github.com/openmultiplayer/open.mp/blob/62a2fa95b36b73640a5b4bb330a1663d6d50adc9/Server/Components/Dialogs/dialog.cpp#L158-L162

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.

NexiusTailer avatar Feb 14 '24 11:02 NexiusTailer