Skip to content

Commit 21fcac6

Browse files
committed
Fix undefined offset error (#54)
1 parent 552226f commit 21fcac6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Palette.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ public function getIterator(): \Traversable
3333
*/
3434
public function getColorCount($color)
3535
{
36+
if (!array_key_exists($color, $this->colors)) {
37+
return 0;
38+
}
39+
3640
return $this->colors[$color];
3741
}
3842

0 commit comments

Comments
 (0)