aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--liblss16_optimise.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/liblss16_optimise.c b/liblss16_optimise.c
index 911fcd2..7cb3b5d 100644
--- a/liblss16_optimise.c
+++ b/liblss16_optimise.c
@@ -51,6 +51,8 @@ liblss16_optimise(struct liblss16_header *header, uint8_t *pixels)
least = zero[0] - nonzero[0];
preferred = 0U;
+ if (ncolours < 16U)
+ ncolours++;
for (x = 1U; x < (unsigned)ncolours; x++) {
zero_penalty = zero[x] - nonzero[x];
if (zero_penalty < least) {