Skip to content

Commit

Permalink
Qt: Fix cancel in LED colour selection
Browse files Browse the repository at this point in the history
  • Loading branch information
stenzek committed Jan 16, 2023
1 parent c393db4 commit e0ed767
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/duckstation-qt/colorpickerbutton.cpp
Expand Up @@ -39,7 +39,9 @@ void ColorPickerButton::onClicked()

const QColor initial(QColor::fromRgb(red, green, blue));
const QColor selected(QColorDialog::getColor(initial, QtUtils::GetRootWidget(this), tr("Select LED Color")));
if (initial == selected)

// QColorDialog returns Invalid on cancel, and apparently initial == Invalid is true...
if (!selected.isValid() || initial == selected)
return;

const u32 new_rgb = (static_cast<u32>(selected.red()) << 16) | (static_cast<u32>(selected.green()) << 8) |
Expand Down

0 comments on commit e0ed767

Please sign in to comment.