From: Takashi Sawanaka Date: Wed, 4 May 2016 11:37:19 +0000 (+0900) Subject: Fix crash when merging X-Git-Tag: 2.16.4+-jp-10~727 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=8083f659567707ca66631163cee683bd83b38b52;p=winmerge-jp%2Fwinmerge-jp.git Fix crash when merging --- diff --git a/Src/MergeDoc.cpp b/Src/MergeDoc.cpp index 28984fe56..9d8b1a30a 100644 --- a/Src/MergeDoc.cpp +++ b/Src/MergeDoc.cpp @@ -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) { diff --git a/Src/MergeDocLineDiffs.cpp b/Src/MergeDocLineDiffs.cpp index 7b953d4f1..f52ab66d0 100644 --- a/Src/MergeDocLineDiffs.cpp +++ b/Src/MergeDocLineDiffs.cpp @@ -148,6 +148,13 @@ void CMergeDoc::GetWordDiffArray(int nLineIndex, vector *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;