X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6f23f80b721b35435c4310483aa69b09a31dec15..57c6f0fe5f31e15e0cf7992f8eb654c82c1b7994:/src/univ/toolbar.cpp diff --git a/src/univ/toolbar.cpp b/src/univ/toolbar.cpp index 9b36cc74ac..7f81f0daa8 100644 --- a/src/univ/toolbar.cpp +++ b/src/univ/toolbar.cpp @@ -691,26 +691,26 @@ void wxToolBar::DoDraw(wxControlRenderer *renderer) { label = tool->GetLabel(); bitmap = tool->GetBitmap(); + + if ( !bitmap.IsOk() ) + { + // it's better not to draw anything than to assert inside + // drawing code as this results in an almost guaranteed crash + // as we're likely to be called by a paint event handler and so + // the assert is going to be triggered again and again and ... + continue; + } } //else: leave both the label and the bitmap invalid to draw a separator if ( !tool->IsControl() ) { - int tbStyle = 0; - if(HasFlag(wxTB_TEXT)) - { + int tbStyle = HasFlag(wxTB_VERTICAL) ? wxTB_VERTICAL : wxTB_HORIZONTAL; + if ( HasFlag(wxTB_TEXT) ) tbStyle |= wxTB_TEXT; - } - if(HasFlag(wxTB_VERTICAL)) - { - tbStyle |= wxTB_VERTICAL; - } - else - { - tbStyle |= wxTB_HORIZONTAL; - } - rend->DrawToolBarButton(dc, label, bitmap, rectTool, flags, tool->GetStyle(), tbStyle); + rend->DrawToolBarButton(dc, label, bitmap, rectTool, flags, + tool->GetStyle(), tbStyle); } else // control {