]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/toolbar.cpp
don't call gtk_selection_data_set_text() with non-UTF-8 data as we did in ANSI build...
[wxWidgets.git] / src / msw / toolbar.cpp
index 5c4b2c4d5b05a10afb18707bff335c83bcfb44ac..e8c47e5ed3e09a7ec923a530ca2bcf1e785f5a94 100644 (file)
@@ -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);