Opened 4 months ago
Last modified 4 months ago
#15294 new defect
AGS: Incorrect Use of Bitwise OR Instead of Logical OR in SetSliderValue — at Initial Version
Reported by: | RainRat | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | Engine: AGS |
Version: | Keywords: | ||
Cc: | Game: |
Description
In the SetSliderValue
and GetSliderValue
functions, the validation checks for the GUI number (guin
) are using the bitwise OR operator (|
) instead of the logical OR operator (||
).
Affected Code:
void SetSliderValue(int guin, int objn, int valn) { if ((guin < 0) | (guin >= _GP(game).numgui)) quit("!SetSliderValue: invalid GUI number"); [...] int GetSliderValue(int guin, int objn) { if ((guin < 0) | (guin >= _GP(game).numgui)) quit("!GetSliderValue: invalid GUI number");
Corrected Code:
void SetSliderValue(int guin, int objn, int valn) { if ((guin < 0) || (guin >= _GP(game).numgui)) quit("!SetSliderValue: invalid GUI number"); [...] int GetSliderValue(int guin, int objn) { if ((guin < 0) || (guin >= _GP(game).numgui)) quit("!GetSliderValue: invalid GUI number");
Note:
See TracTickets
for help on using tickets.