From e86eb9337a8e11b029327cef43861ee15e660285 Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Sun, 13 Mar 2022 11:02:31 +0100 Subject: [PATCH] Check the range of the CLI-specified palette size --- src/gfx/main.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/gfx/main.cpp b/src/gfx/main.cpp index 8a7a7986..7d94f646 100644 --- a/src/gfx/main.cpp +++ b/src/gfx/main.cpp @@ -350,6 +350,11 @@ int main(int argc, char *argv[]) { if (*arg != '\0') { error("Palette size (-s) argument must be a valid number, not \"%s\"", musl_optarg); } + if (options.nbColorsPerPal > 4) { + error("Palette size (-s) argument must not exceed 4!"); + } else if (options.nbColorsPerPal == 0) { + error("Palette size (-s) argument may not be 0!"); + } break; case 'T': autoTilemap = true;