Merge pull request #57 from mhahmadi/mhahmadi_fix_getpalette_validation

fixes #56
This commit is contained in:
Lokesh Dhakar
2016-11-06 15:41:06 -08:00
committed by GitHub

View File

@@ -98,7 +98,7 @@ ColorThief.prototype.getColor = function(sourceImage, quality) {
*/ */
ColorThief.prototype.getPalette = function(sourceImage, colorCount, quality) { ColorThief.prototype.getPalette = function(sourceImage, colorCount, quality) {
if (typeof colorCount === 'undefined') { if (typeof colorCount === 'undefined' || colorCount < 2 || colorCount > 256) {
colorCount = 10; colorCount = 10;
} }
if (typeof quality === 'undefined' || quality < 1) { if (typeof quality === 'undefined' || quality < 1) {