PrimeIntellect/SWE-rebench-V2-Filtered-Easy-Verified huggingface dataset:
Repository: wangguanquan/eec (java)
Issue: ListSheet写入空数组时抛IndexOutOfBoundsException异常
```
// 测试代码
new Workbook().addSheet(new ListSheet<>(new ArrayList<Student>())).writeTo(defaultTestPath);
```

异常信息

```
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0

	at java.util.ArrayList.rangeCheck(ArrayList.java:657)
	at java.util.ArrayList.get(ArrayList.java:433)
	at org.ttzero.excel.entity.ListSheet.getFirst(ListSheet.java:191)
	at org.ttzero.excel.entity.ListSheet.getTClass(ListSheet.java:323)
	at org.ttzero.excel.entity.ListSheet.init(ListSheet.java:368)
```
Pull request description: fix #132 ListSheet写入空数组时抛IndexOutOfBoundsException异常

Patch:
diff --git a/src/main/java/org/ttzero/excel/entity/ListSheet.java b/src/main/java/org/ttzero/excel/entity/ListSheet.java
index e12b04a4..c4c97678 100644
--- a/src/main/java/org/ttzero/excel/entity/ListSheet.java
+++ b/src/main/java/org/ttzero/excel/entity/ListSheet.java
@@ -187,7 +187,7 @@ public class ListSheet<T> extends Sheet {
      * @return the object
      */
     protected T getFirst() {
-        if (data == null) return null;
+        if (data == null || data.isEmpty()) return null;
         T first = data.get(start);
         if (first != null) return first;
         int i = start + 1;


Test patch:
diff --git a/src/test/java/org/ttzero/excel/entity/ListObjectSheetTest.java b/src/test/java/org/ttzero/excel/entity/ListObjectSheetTest.java
index e5ddff8a..c1791252 100644
--- a/src/test/java/org/ttzero/excel/entity/ListObjectSheetTest.java
+++ b/src/test/java/org/ttzero/excel/entity/ListObjectSheetTest.java
@@ -471,6 +471,11 @@ public class ListObjectSheetTest extends WorkbookTest{
         }).writeTo(defaultTestPath);
     }
 
+    // #132
+    @Test public void testEmptyList() throws IOException {
+        new Workbook().addSheet(new ListSheet<>(new ArrayList<>())).writeTo(defaultTestPath);
+    }
+
     public static class Item {
         private int id;
         private String name;