diff -r 52e10e8d88cc -r 1a4342d80de7 src/widgets/colorindexinput.cpp --- a/src/widgets/colorindexinput.cpp Wed Jun 08 19:33:00 2022 +0300 +++ b/src/widgets/colorindexinput.cpp Wed Jun 08 20:41:21 2022 +0300 @@ -3,7 +3,7 @@ #include "colorselectdialog.h" #include "uiutilities.h" -ColorIndexInput::ColorIndexInput(EditorTabWidget *document, ldraw::Color color, QWidget *parent) : +ColorIndexInput::ColorIndexInput(EditorTabWidget *document, ColorIndex color, QWidget *parent) : QWidget{parent}, document{document}, ui{*new Ui_ColorIndexInput} @@ -20,8 +20,11 @@ }); connect(this->ui.index, qOverload(&QSpinBox::valueChanged), [this](int value) { - this->ui.button->setText(ldraw::colorDisplayName({value}, this->document->colorTable)); - uiutilities::colorizeWidget(this->ui.button, ldraw::colorFace({value}, this->document->colorTable)); + this->ui.button->setText(colorDisplayName({value}, this->document->colorTable).value_or("???")); + const opt face = colorFace({value}, this->document->colorTable); + if (face.has_value()) { + uiutilities::colorizeWidget(this->ui.button, *face); + } Q_EMIT this->colorChanged({value}); }); this->ui.index->setValue(color.index);