Fix null cells reference

This commit is contained in:
Sergey Chebotar 2023-05-23 07:55:14 +03:00
parent 28c5a69797
commit fba2859b84

View File

@ -57,6 +57,11 @@ public class GuessReader : IReader
int successCounter = 0; int successCounter = 0;
object[,] cells = column.Value2; object[,] cells = column.Value2;
if (cells == null)
{
return false;
}
for (int row = 1; row < column.Rows.Count + 1; row++) for (int row = 1; row < column.Rows.Count + 1; row++)
{ {
object currentCell = cells[row, 1]; object currentCell = cells[row, 1];
@ -81,9 +86,15 @@ public class GuessReader : IReader
private bool IsAmountColumn(Range column, out double average) private bool IsAmountColumn(Range column, out double average)
{ {
object[,] cells = column.Value2;
int successCounter = 0;
average = 0.0; average = 0.0;
object[,] cells = column.Value2;
if (cells == null)
{
return false;
}
int successCounter = 0;
for (int row = 1; row < column.Rows.Count + 1; row++) for (int row = 1; row < column.Rows.Count + 1; row++)
{ {