Skip to content

Commit

Permalink
Fix issue #2556: "Debug Assertion Failed!" Error When Refreshing Afte…
Browse files Browse the repository at this point in the history
…r Deleting All Content in Left or Right Pane (2)
  • Loading branch information
sdottaka committed Nov 26, 2024
1 parent 42ef851 commit acfca49
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions Src/MergeDocLineDiffs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -392,16 +392,18 @@ CMergeDoc::GetWordDiffArrayInRange(const int begin[3], const int end[3], bool ig
}
wd.beginline[i] = nLine;
wd.begin[i] = it->begin[i] - nOffsets[file][nLine-nLineBegin];
if (m_ptBuf[file]->GetLineLength(nLine) < wd.begin[i])
const int nLineCount = m_ptBuf[file]->GetLineCount();
const int nLineLength1 = nLine < nLineCount ? m_ptBuf[file]->GetLineLength(nLine) : 0;
if (nLineLength1 < wd.begin[i])
{
if (wd.beginline[i] < m_ptBuf[file]->GetLineCount() - 1)
if (wd.beginline[i] < nLineCount - 1)
{
wd.begin[i] = 0;
wd.beginline[i]++;
}
else
{
wd.begin[i] = m_ptBuf[file]->GetLineLength(nLine);
wd.begin[i] = nLineLength1;
}
}

Expand All @@ -412,16 +414,17 @@ CMergeDoc::GetWordDiffArrayInRange(const int begin[3], const int end[3], bool ig
}
wd.endline[i] = nLine;
wd.end[i] = it->end[i] + 1 - nOffsets[file][nLine-nLineBegin];
if (m_ptBuf[file]->GetLineLength(nLine) < wd.end[i])
const int nLineLength2 = nLine < nLineCount ? m_ptBuf[file]->GetLineLength(nLine) : 0;
if (nLineLength2 < wd.end[i])
{
if (wd.endline[i] < m_ptBuf[file]->GetLineCount() - 1)
if (wd.endline[i] < nLineCount - 1)
{
wd.end[i] = 0;
wd.endline[i]++;
}
else
{
wd.end[i] = m_ptBuf[file]->GetLineLength(nLine);
wd.end[i] = nLineLength2;
}
}
}
Expand Down

0 comments on commit acfca49

Please sign in to comment.