git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42669 
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
 { 
     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())