X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3721dc6efe6f9ffe550c4c83bee2da210043bcaa..f9b4d680d72930c31fe14dd63421a85d97ccd739:/src/osx/cocoa/colour.mm diff --git a/src/osx/cocoa/colour.mm b/src/osx/cocoa/colour.mm index 55a305d29f..a59b71b2c0 100644 --- a/src/osx/cocoa/colour.mm +++ b/src/osx/cocoa/colour.mm @@ -23,14 +23,21 @@ wxColour::wxColour(WX_NSColor col) { size_t noComp = [col numberOfComponents]; - CGFloat *components = NULL; - if ( noComp >= 1 && noComp <= 4 ) + CGFloat components[4]; + CGFloat *p; + if ( noComp < 1 || noComp > WXSIZEOF(components) ) { // TODO verify whether we really are on a RGB color space m_alpha = wxALPHA_OPAQUE; [col getComponents: components]; + p = components; } - InitFromComponents(const_cast(components), noComp); + else // Unsupported colour format. + { + p = NULL; + } + + InitFromComponents(components, noComp); } WX_NSColor wxColour::OSXGetNSColor()