Piotr Czajkowski 1 nedēļu atpakaļ
vecāks
revīzija
a5121bed88

+ 1 - 1
ExcelORM/ExcelORM/ExcelDynamicReader.cs

@@ -87,7 +87,7 @@ public sealed class ExcelDynamicReader : IDisposable
 
     public IEnumerable<List<DynamicCell>> Read(int worksheetIndex = 1, uint startFrom = 1, uint skip = 0)
     {
-        if (worksheetIndex > xlWorkbook.Worksheets.Count) yield break;
+        if (worksheetIndex < 1 || worksheetIndex > xlWorkbook.Worksheets.Count) yield break;
 
         var worksheet = xlWorkbook.Worksheets.FirstOrDefault(x => x.Position == worksheetIndex);
         if (worksheet == null) yield break;

+ 1 - 1
ExcelORM/ExcelORM/ExcelReader.cs

@@ -101,7 +101,7 @@ public sealed class ExcelReader : IDisposable
 
     public IEnumerable<T> Read<T>(int worksheetIndex = 1, uint startFrom = 1, uint skip = 0) where T : class
     {
-        if (worksheetIndex > xlWorkbook.Worksheets.Count) yield break;
+        if (worksheetIndex < 1 || worksheetIndex > xlWorkbook.Worksheets.Count) yield break;
 
         var worksheet = xlWorkbook.Worksheets.FirstOrDefault(x => x.Position == worksheetIndex);
         if (worksheet == null) yield break;