mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-15 11:03:00 +01:00
Guard against illegal access
This commit is contained in:
@@ -35,8 +35,12 @@ struct GamePalette
|
||||
{
|
||||
PaletteBGRA Colour[PALETTE_SIZE];
|
||||
|
||||
const PaletteBGRA& operator[](uint16_t idx) const
|
||||
const PaletteBGRA operator[](uint16_t idx) const
|
||||
{
|
||||
assert(idx < PALETTE_SIZE);
|
||||
if (idx >= PALETTE_SIZE)
|
||||
return {};
|
||||
|
||||
return Colour[idx];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user