Fix wxWindow::setBackgroundColour(wxNullColour) on OS X

Commit 91aa6ba36e introduced a
regression causing this to crash. We need to validate that the color
is valid before attempting to call OSXGetNSColor; if it is not, we
should clear any previously-set background color.

Closes #18470.

Closes https://github.com/wxWidgets/wxWidgets/pull/1503
This commit is contained in:
Jeff Davidson
2019-08-23 22:36:18 -07:00
committed by Vadim Zeitlin
parent 70e9dbd756
commit 04dfe90e55

View File

@@ -3177,7 +3177,8 @@ void wxWidgetCocoaImpl::SetBackgroundColour( const wxColour &col )
wxTopLevelWindow* toplevel = wxDynamicCast(peer,wxTopLevelWindow);
if ( toplevel == NULL || toplevel->GetShape().IsEmpty() )
[targetView setBackgroundColor: col.OSXGetNSColor()];
[targetView setBackgroundColor:
col.IsOk() ? col.OSXGetNSColor() : nil];
}
}
}