Check that colour slot is non-empty before checking for gray-ness

This is otherwise UB, and trips a GLIBCXX assertion (when enabled).
This commit is contained in:
ISSOtm
2022-10-11 21:39:32 +02:00
parent 0e0876b17f
commit 12ba057b4f

View File

@@ -142,7 +142,7 @@ public:
}
uint8_t bins = 0;
for (auto const &color : colors) {
if (color->isTransparent()) {
if (!color.has_value() || color->isTransparent()) {
continue;
}
if (!color->isGray()) {