macOS: Return invalid QColor if qt_mac_toQColor is called with a nil NSColor
Call sites of qt_mac_toQColor may not necessarily check the NSColor for nil before passing it to qt_mac_toQColor, as seen for example in the QCocoaColorPicker implementation. Without an explicit nil check we ended up returning a valid QColor with all color components set to 0. Pick-to: 6.7 Change-Id: I0cc36049fca05a6b668c0c610bc40eedbc72df3a Reviewed-by: Doris Verria <doris.verria@qt.io> (cherry picked from commit 271bfe4a5405309dc8d48807d6f28d174efb2cc2) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
6e98673846
commit
f30fb442af
@ -228,6 +228,9 @@ QColor qt_mac_toQColor(CGColorRef color)
|
||||
#ifdef Q_OS_MACOS
|
||||
QColor qt_mac_toQColor(const NSColor *color)
|
||||
{
|
||||
if (!color)
|
||||
return QColor();
|
||||
|
||||
QColor qtColor;
|
||||
switch (color.type) {
|
||||
case NSColorTypeComponentBased: {
|
||||
|
Loading…
x
Reference in New Issue
Block a user