OSDN Git Service

Fix crash when merging
authorTakashi Sawanaka <sdottaka@users.sourceforge.net>
Wed, 4 May 2016 11:37:19 +0000 (20:37 +0900)
committerTakashi Sawanaka <sdottaka@users.sourceforge.net>
Wed, 4 May 2016 11:37:19 +0000 (20:37 +0900)
Src/MergeDoc.cpp
Src/MergeDocLineDiffs.cpp

index 28984fe..9d8b1a3 100644 (file)
@@ -860,6 +860,11 @@ void CMergeDoc::CopyMultipleList(int srcPane, int dstPane, int firstDiff, int la
        CPoint currentPosDst = m_pView[dstPane]->GetCursorPos();
        currentPosDst.x = 0;
 
+       CPoint pt(0, 0);
+       m_pView[dstPane]->SetCursorPos(pt);
+       m_pView[dstPane]->SetNewSelection(pt, pt, false);
+       m_pView[dstPane]->SetNewAnchor(pt);
+
        // copy from bottom up is more efficient
        for (int i = lastDiff - 1; i >= firstDiff; --i)
        {
@@ -967,6 +972,11 @@ void CMergeDoc::DoAutoMerge(int dstPane)
        CPoint currentPosDst = m_pView[dstPane]->GetCursorPos();
        currentPosDst.x = 0;
 
+       CPoint pt(0, 0);
+       m_pView[dstPane]->SetCursorPos(pt);
+       m_pView[dstPane]->SetNewSelection(pt, pt, false);
+       m_pView[dstPane]->SetNewAnchor(pt);
+
        // copy from bottom up is more efficient
        for (int i = lastDiff; i >= firstDiff; --i)
        {
index 7b953d4..f52ab66 100644 (file)
@@ -148,6 +148,13 @@ void CMergeDoc::GetWordDiffArray(int nLineIndex, vector<WordDiff> *pWordDiffs)
 {
        int file;
        DIFFRANGE cd;
+
+       for (file = 0; file < m_nBuffers; file++)
+       {
+               if (nLineIndex >= m_ptBuf[file]->GetLineCount())
+                       return;
+       }
+
        int nDiff = m_diffList.LineToDiff(nLineIndex);
        if (nDiff == -1)
                return;