Skip to content

Commit f3cad63

Browse files
DYN-8615 OpenXML Excel Exception (#16185)
1 parent f651178 commit f3cad63

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Libraries/DSOfficeUtilities/OpenXmlHelper.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,10 @@ private static int GetLargestColumnIndex(SheetData sheetData)
256256
foreach (var row in sheetData.Elements<Row>())
257257
{
258258
var lastCell = row.LastChild as Cell;
259+
260+
//When we have an empty row sometimes the Row.LastChild is null, so this validation will avoid the "Object reference not set to an instance of an object" error.
261+
if (lastCell == null) continue;
262+
259263
var current = GetColumnIndex(lastCell.CellReference);
260264
if (current > result)
261265
{

0 commit comments

Comments
 (0)