ReoGrid: StackOverflowException in SetVBorders
Hello,
I believe I found a bug in the code. When pasting a region with borders, under circumstances that escape me at the moment, SetVBorders in Core\Borders.cs (row 978) will run recursively until a Stack Overflow is reached.
For some reason, nextStartRow never becomes -1 to stop the loop. I’ve been staring at this code for a while now but I can’t figure out what it’s checking for:
// when the cols splitted by a merged range, need find it
int tr = r2;
int nextStartRow = -1;
for (int k = sr; k < r2; k++)
{
if (col > 0)
{
Cell cell1 = cells[k, col - 1];
Cell cell2 = cells[k, col];
if (cell1 != null && cell2 != null
&& !cell1.MergeStartPos.IsEmpty
&& CellPosition.Equals(cell1.MergeStartPos, cell2.MergeStartPos))
{
tr = k;
nextStartRow = cell2.MergeEndPos.Row + 1;
break;
}
}
}
Is anyone here wise enough to figure this out please?
Best Wishes,
Adam
About this issue
- Original URL
- State: open
- Created 6 years ago
- Comments: 34 (8 by maintainers)
Commits related to this issue
- add test case #95 — committed to unvell/ReoGrid by jingwood 6 years ago
Give me more time.
Meanwhile, the bug only happens when you edit the first row or column on a worksheet, you may try to add an empty dummy row or column and hide it before your data to try to avoid this problem as a workaround.
Another gentle nudge 🙏