From e08df6c31625b8255d60ec45ecd2b603bc67179b Mon Sep 17 00:00:00 2001 From: Mohamad Ahmadi Date: Sun, 15 Feb 2015 12:01:47 -0500 Subject: [PATCH] fixes #54 Signed-off-by: Mohamad Ahmadi --- src/color-thief.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/color-thief.js b/src/color-thief.js index 615ac29..935094f 100644 --- a/src/color-thief.js +++ b/src/color-thief.js @@ -128,7 +128,7 @@ ColorThief.prototype.getPalette = function(sourceImage, colorCount, quality) { // Send array to quantize function which clusters values // using median cut algorithm var cmap = MMCQ.quantize(pixelArray, colorCount); - var palette = cmap.palette(); + var palette = cmap? cmap.palette() : null; // Clean up image.removeCanvas();