Browse Source

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.
jp9000 5 years ago
parent
commit
55c21319e0
1 changed files with 6 additions and 1 deletions
  1. 6 1
      UI/context-bar-controls.cpp

+ 6 - 1
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();