From 55c21319e09e094f66db557ba81aa7d8ec71e53a Mon Sep 17 00:00:00 2001 From: jp9000 Date: Thu, 3 Sep 2020 05:14:28 -0700 Subject: [PATCH] UI: Fix source toolbar color selection on color source When selecting a color on the color source, if you pressed cancel, it would cause it to set the color to black. Instead, make sure to check isValid() on the returned color value to see if the user pressed cancel when selecting a color. --- UI/context-bar-controls.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/UI/context-bar-controls.cpp b/UI/context-bar-controls.cpp index 5fe2bb2b6..21cc0badc 100644 --- a/UI/context-bar-controls.cpp +++ b/UI/context-bar-controls.cpp @@ -455,7 +455,12 @@ void ColorSourceToolbar::on_choose_clicked() options |= QColorDialog::DontUseNativeDialog; #endif - color = QColorDialog::getColor(color, this, desc, options); + QColor newColor = QColorDialog::getColor(color, this, desc, options); + if (!newColor.isValid()) { + return; + } + + color = newColor; UpdateColor(); obs_data_t *settings = obs_data_create();