aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/gfx
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sci/gfx')
-rw-r--r--engines/sci/gfx/gfx_driver.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/engines/sci/gfx/gfx_driver.cpp b/engines/sci/gfx/gfx_driver.cpp
index e96caa19e8..e5efd9d586 100644
--- a/engines/sci/gfx/gfx_driver.cpp
+++ b/engines/sci/gfx/gfx_driver.cpp
@@ -341,6 +341,12 @@ scummvm_set_pointer(struct _gfx_driver *drv, gfx_pixmap_t *pointer) {
static int
scummvm_set_palette(struct _gfx_driver *drv, int index, byte red, byte green, byte blue) {
+ if (index < 0 || index > 255)
+ {
+ GFXERROR("Attempt to set invalid palette entry %d\n", index);
+ return GFX_ERROR;
+ }
+
byte color[] = {red, green, blue, 255};
g_system->setPalette(color, index, 1);
return GFX_OK;