guarding against setting of NULL

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42669 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2006-10-29 21:01:36 +00:00
parent b2e2f9507b
commit 914fd3f1e5

View File

@@ -61,15 +61,17 @@ void wxGCDC::SetGraphicsContext( wxGraphicsContext* ctx )
{ {
delete m_graphicContext; delete m_graphicContext;
m_graphicContext = ctx; m_graphicContext = ctx;
m_matrixOriginal = m_graphicContext->GetTransform(); if ( m_graphicContext )
{
m_matrixOriginal = m_graphicContext->GetTransform();
m_ok = true;
}
} }
wxGCDC::wxGCDC(const wxWindowDC& dc) wxGCDC::wxGCDC(const wxWindowDC& dc)
{ {
Init(); Init();
m_graphicContext = wxGraphicsContext::Create(dc); SetGraphicsContext( wxGraphicsContext::Create(dc) );
m_matrixOriginal = m_graphicContext->GetTransform();
m_ok = true;
if ( dc.GetFont().Ok()) if ( dc.GetFont().Ok())
m_graphicContext->SetFont( m_graphicContext->CreateFont(dc.GetFont(),dc.GetTextForeground())); m_graphicContext->SetFont( m_graphicContext->CreateFont(dc.GetFont(),dc.GetTextForeground()));
if ( dc.GetPen().Ok()) if ( dc.GetPen().Ok())