X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3c30bbb9faaa517f4fa3a4e896a945f3db82b1b0..624f82cc945369fee912cd4bd56a1e84f4920502:/src/msw/toolbar.cpp diff --git a/src/msw/toolbar.cpp b/src/msw/toolbar.cpp index 5c4b2c4d5b..e8c47e5ed3 100644 --- a/src/msw/toolbar.cpp +++ b/src/msw/toolbar.cpp @@ -581,13 +581,15 @@ bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *tool) wxToolBarTool *tool2 = (wxToolBarTool*)node->GetData(); if ( tool2->IsControl() ) { + wxControl * const control = tool2->GetControl(); + int x; - wxControl *control = tool2->GetControl(); control->GetPosition(&x, NULL); control->Move(x - width, wxDefaultCoord); - wxStaticText* staticText = tool2->GetStaticText(); - staticText->Move(x - width, wxDefaultCoord); + wxStaticText * const staticText = tool2->GetStaticText(); + if ( staticText ) + staticText->Move(x - width, wxDefaultCoord); } } @@ -1642,6 +1644,10 @@ void wxToolBar::OnEraseBackground(wxEraseEvent& event) bool wxToolBar::HandleSize(WXWPARAM WXUNUSED(wParam), WXLPARAM lParam) { + // wait until we have some tools + if ( !GetToolsCount() ) + return false; + // calculate our minor dimension ourselves - we're confusing the standard // logic (TB_AUTOSIZE) with our horizontal toolbars and other hacks const RECT r = wxGetTBItemRect(GetHwnd(), 0);