diff --git a/src/osx/cocoa/dataview.mm b/src/osx/cocoa/dataview.mm index e9ba27f366..ba62b1749b 100644 --- a/src/osx/cocoa/dataview.mm +++ b/src/osx/cocoa/dataview.mm @@ -3299,16 +3299,20 @@ void wxDataViewColumn::SetWidth(int width) { m_width = width; + if ( !GetOwner() ) + { + // can't set the real width yet + return; + } + switch ( width ) { case wxCOL_WIDTH_AUTOSIZE: - if ( GetOwner() ) { wxCocoaDataViewControl *peer = static_cast(GetOwner()->GetPeer()); peer->FitColumnWidthToContent(GetOwner()->GetColumnPosition(this)); break; } - // fall through if not yet settable case wxCOL_WIDTH_DEFAULT: width = wxDVC_DEFAULT_WIDTH;