OSDN Git Service

GhostTextView.cpp: Fix crash when selecting the Window->Split menu item
authorTakashi Sawanaka <sdottaka@users.sourceforge.net>
Wed, 3 Apr 2019 22:41:48 +0000 (07:41 +0900)
committerTakashi Sawanaka <sdottaka@users.sourceforge.net>
Wed, 3 Apr 2019 22:41:48 +0000 (07:41 +0900)
Src/GhostTextView.cpp

index fa6ee59..fa90d8d 100644 (file)
@@ -93,7 +93,10 @@ void CGhostTextView::popPosition(SCursorPushed Ssrc, CPoint & pt)
 void CGhostTextView::pushPosition(SCursorPushed & Sdest, CPoint pt)
 {
        Sdest.x = pt.x;
-       Sdest.y = m_pGhostTextBuffer->ComputeRealLineAndGhostAdjustment(pt.y, Sdest.nToFirstReal);
+       if (m_pGhostTextBuffer)
+               Sdest.y = m_pGhostTextBuffer->ComputeRealLineAndGhostAdjustment(pt.y, Sdest.nToFirstReal);
+       else
+               Sdest.y = pt.y;
 }
 
 void CGhostTextView::PopCursors ()
@@ -178,7 +181,7 @@ void CGhostTextView::PushCursors ()
                pushPosition(m_ptSavedSelEndPushed, m_ptSavedSelEnd);
        }
 
-       pushPosition(m_ptLastChangePushed, m_pGhostTextBuffer->GetLastChangePos());
+       pushPosition(m_ptLastChangePushed, m_pGhostTextBuffer ? m_pGhostTextBuffer->GetLastChangePos() : CPoint{0, 0});
 
        // and top line positions
        m_nTopSubLinePushed = m_nTopSubLine;