]> git.saurik.com Git - wxWidgets.git/commitdiff
avoid accepting an invalid color, ignore it, as other ports do, fixes #13720
authorStefan Csomor <csomor@advancedconcepts.ch>
Fri, 9 Dec 2011 15:23:37 +0000 (15:23 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Fri, 9 Dec 2011 15:23:37 +0000 (15:23 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69967 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/dcgraph.cpp

index 1f08538f85fa5436a4dec403e0215e95a0d2dc83..9dc59efb53a9537189428a09fb71827672939a88 100644 (file)
@@ -382,7 +382,10 @@ void wxGCDCImpl::SetTextForeground( const wxColour &col )
 {
     wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::SetTextForeground - invalid DC") );
 
-    if ( col != m_textForegroundColour )
+    // don't set m_textForegroundColour to an invalid colour as we'd crash
+    // later then (we use m_textForegroundColour.GetColor() without checking
+    // in a few places)
+    if ( col.IsOk() && col != m_textForegroundColour )
     {
         m_textForegroundColour = col;
         m_graphicContext->SetFont( m_font, m_textForegroundColour );