Explorar o código

bug fix

bug fix
zhcy %!s(int64=13) %!d(string=hai) anos
pai
achega
f3d89a40af
Modificáronse 2 ficheiros con 1 adicións e 6 borrados
  1. 0 5
      lib.go
  2. 1 1
      worksheet.go

+ 0 - 5
lib.go

@@ -336,11 +336,6 @@ func readRowsFromSheet(Worksheet *xlsxWorksheet, file *File) ([]*Row, int, int)
 		}
 		}
 		rows[y] = row
 		rows[y] = row
 	}
 	}
-	for i := 0; i < len(rows); i++ {
-		if rows[i] == nil {
-			rows[i] = new(Row)
-		}
-	}
 	return rows, maxCol, maxRow
 	return rows, maxCol, maxRow
 }
 }
 
 

+ 1 - 1
worksheet.go

@@ -96,7 +96,7 @@ type xlsxC struct {
 // get cell
 // get cell
 func (sh *Sheet) Cell(row, col int) *Cell {
 func (sh *Sheet) Cell(row, col int) *Cell {
 
 
-	if len(sh.Rows) > row && len(sh.Rows[row].Cells) > col {
+	if len(sh.Rows) > row && sh.Rows[row] != nil && len(sh.Rows[row].Cells) > col {
 		return sh.Rows[row].Cells[col]
 		return sh.Rows[row].Cells[col]
 	}
 	}
 	return new(Cell)
 	return new(Cell)