diff --git a/src/osx/imaglist.cpp b/src/osx/imaglist.cpp index b057fe3c3f..32f12fb4ee 100644 --- a/src/osx/imaglist.cpp +++ b/src/osx/imaglist.cpp @@ -147,13 +147,13 @@ wxIcon wxImageList::GetIcon(int index) const wxObject* obj = (wxObject*) node->GetData(); if ( obj == NULL ) return wxNullIcon ; - else if ( obj->IsKindOf(CLASSINFO(wxBitmap)) ) + if ( obj->IsKindOf(CLASSINFO(wxBitmap)) ) { - wxFAIL_MSG( wxT("cannot convert from bitmap to icon") ) ; - return wxNullIcon ; + wxIcon icon; + icon.CopyFromBitmap(*static_cast(obj)); + return icon; } - else - return *(static_cast(obj)) ; + return *(static_cast(obj)) ; } bool wxImageList::Replace( int index, const wxBitmap &bitmap )