diff --git a/src/Palette.php b/src/Palette.php index 4ea1d41..8b99d54 100644 --- a/src/Palette.php +++ b/src/Palette.php @@ -76,6 +76,9 @@ public function __construct($swatches) private function findMaxPopulation() { + if (!$this->swatches) { + return null; + } return max(array_map(function (Swatch $swatch) { return $swatch->getPopulation(); }, $this->swatches));