X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/82614b1a723d277cbf5810bdad8e84eb7d8825ed..08670ea85abf4b4946a9ce64971b591d7b1ee30b:/src/common/dcgraph.cpp diff --git a/src/common/dcgraph.cpp b/src/common/dcgraph.cpp index 1f08538f85..9dc59efb53 100644 --- a/src/common/dcgraph.cpp +++ b/src/common/dcgraph.cpp @@ -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 );