Browse Source

bug fix

bug fix
zhcy 13 years ago
parent
commit
f3d89a40af
2 changed files with 1 additions and 6 deletions
  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
 	}
-	for i := 0; i < len(rows); i++ {
-		if rows[i] == nil {
-			rows[i] = new(Row)
-		}
-	}
 	return rows, maxCol, maxRow
 }
 

+ 1 - 1
worksheet.go

@@ -96,7 +96,7 @@ type xlsxC struct {
 // get 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 new(Cell)