diff --git a/macosx/osxwin.m b/macosx/osxwin.m index 169ae648..b58742d9 100644 --- a/macosx/osxwin.m +++ b/macosx/osxwin.m @@ -957,7 +957,7 @@ void palette_set(void *frontend, int n, int r, int g, int b) if (n >= 16) n += 256 - 16; - if (n > NALLCOLOURS) + if (n >= NALLCOLOURS) return; [win setColour:n r:r/255.0 g:g/255.0 b:b/255.0]; diff --git a/windows/window.c b/windows/window.c index b477d6ae..f1f72525 100644 --- a/windows/window.c +++ b/windows/window.c @@ -4805,7 +4805,7 @@ void palette_set(void *frontend, int n, int r, int g, int b) { if (n >= 16) n += 256 - 16; - if (n > NALLCOLOURS) + if (n >= NALLCOLOURS) return; real_palette_set(n, r, g, b); if (pal) {