From 914fd3f1e5b3a2be1b1d9a551e462f7ba717af58 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Sun, 29 Oct 2006 21:01:36 +0000 Subject: [PATCH] guarding against setting of NULL git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42669 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/dcgraph.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/common/dcgraph.cpp b/src/common/dcgraph.cpp index e0ff46275c..be08d5b29c 100644 --- a/src/common/dcgraph.cpp +++ b/src/common/dcgraph.cpp @@ -61,15 +61,17 @@ void wxGCDC::SetGraphicsContext( wxGraphicsContext* ctx ) { delete m_graphicContext; m_graphicContext = ctx; - m_matrixOriginal = m_graphicContext->GetTransform(); + if ( m_graphicContext ) + { + m_matrixOriginal = m_graphicContext->GetTransform(); + m_ok = true; + } } wxGCDC::wxGCDC(const wxWindowDC& dc) { Init(); - m_graphicContext = wxGraphicsContext::Create(dc); - m_matrixOriginal = m_graphicContext->GetTransform(); - m_ok = true; + SetGraphicsContext( wxGraphicsContext::Create(dc) ); if ( dc.GetFont().Ok()) m_graphicContext->SetFont( m_graphicContext->CreateFont(dc.GetFont(),dc.GetTextForeground())); if ( dc.GetPen().Ok()) -- 2.45.2