summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/gd/libgd/gd_topal.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/gd/libgd/gd_topal.c b/ext/gd/libgd/gd_topal.c
index 392e93419e..7e2de25fc5 100644
--- a/ext/gd/libgd/gd_topal.c
+++ b/ext/gd/libgd/gd_topal.c
@@ -1493,7 +1493,7 @@ gdImageTrueColorToPalette (gdImagePtr im, int dither, int colorsWanted)
my_cquantize_ptr cquantize = 0;
int i;
size_t arraysize;
- if (!im->trueColor)
+ if (!im->trueColor || colorsWanted <= 0)
{
/* Nothing to do! */
return;