Guard against illegal access

This commit is contained in:
Gymnasiast committed 2020-05-19 21:25:27 +02:00
1 parent 4b25345d8d
commit de69bbd661
1 file changed
+5 -1
+5 -1
View File
@@ -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];
}