diff --git a/src/gfx/convert.cpp b/src/gfx/convert.cpp index 300b9bb8..3d3a99b7 100644 --- a/src/gfx/convert.cpp +++ b/src/gfx/convert.cpp @@ -937,6 +937,11 @@ contained:; } } + if (palettes.size() > options.nbPalettes) { + // If the palette generation is wrong, other (dependee) operations are likely to be nonsensical, so fatal-error outright + fatal("Generated %zu palettes, over the maximum of %" PRIu8, palettes.size(), options.nbPalettes); + } + if (!options.palettes.empty()) { outputPalettes(palettes); } diff --git a/src/gfx/main.cpp b/src/gfx/main.cpp index 77d54e7d..ece311ce 100644 --- a/src/gfx/main.cpp +++ b/src/gfx/main.cpp @@ -333,7 +333,7 @@ int main(int argc, char *argv[]) { } break; case 'n': - options.nbPalettes = 0; // TODO + options.nbPalettes = parseNumber(arg, "Number of palettes", 8); break; case 'o': options.output = musl_optarg;