]> git.saurik.com Git - wxWidgets.git/commitdiff
Fix crash by checking if icon is valid before drawing it, fixes #12376: PATCH for...
authorRobert Roebling <robert@roebling.de>
Sat, 21 Aug 2010 09:39:09 +0000 (09:39 +0000)
committerRobert Roebling <robert@roebling.de>
Sat, 21 Aug 2010 09:39:09 +0000 (09:39 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65372 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/ribbon/art_aui.cpp
src/ribbon/art_msw.cpp

index a0f40869f542235ee7fc9a38d500923e6e8a3a0b..d127da85bc1d8bb26e9fdf62fe7ad6eed4e34bbc 100644 (file)
@@ -387,9 +387,12 @@ void wxRibbonAUIArtProvider::DrawTab(wxDC& dc,
         icon = tab.page->GetIcon();
         if((m_flags & wxRIBBON_BAR_SHOW_PAGE_LABELS) == 0)
         {
+            if(icon.IsOk())
+            {
             int x = tab.rect.x + (tab.rect.width - icon.GetWidth()) / 2;
             dc.DrawBitmap(icon, x, tab.rect.y + 1 + (tab.rect.height - 1 -
                 icon.GetHeight()) / 2, true);
+            }
         }
     }
     if(m_flags & wxRIBBON_BAR_SHOW_PAGE_LABELS)
index ad494d5863fcac5ff1f520c48e816f9fdff7c431..562c89772aec320b0a4ff2c56172e4611984f411 100644 (file)
@@ -1035,11 +1035,14 @@ void wxRibbonMSWArtProvider::DrawTab(
     if(m_flags & wxRIBBON_BAR_SHOW_PAGE_ICONS)
     {
         wxBitmap icon = tab.page->GetIcon();
+        if(icon.IsOk())
+        {
         int x = tab.rect.x + 4;
         if((m_flags & wxRIBBON_BAR_SHOW_PAGE_LABELS) == 0)
             x = tab.rect.x + (tab.rect.width - icon.GetWidth()) / 2;
         dc.DrawBitmap(icon, x, tab.rect.y + 1 + (tab.rect.height - 1 -
             icon.GetHeight()) / 2, true);
+        }
     }
     if(m_flags & wxRIBBON_BAR_SHOW_PAGE_LABELS)
     {