Skip to content

Commit 52bd454

Browse files
committed
Palette::findMaxPopulation() returns null for no swatches
1 parent 956f5a2 commit 52bd454

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/Palette.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ public function __construct($swatches)
7676

7777
private function findMaxPopulation()
7878
{
79+
if (!$this->swatches) {
80+
return null;
81+
}
7982
return max(array_map(function (Swatch $swatch) {
8083
return $swatch->getPopulation();
8184
}, $this->swatches));

0 commit comments

Comments
 (0)