Fatal Error on non object in Worksheet.php

the disconnectCells method is not always fully initialized with the attribute 
_cellCollection, so a check needs to be done. Otherwise a fatal error occurs.
happens if multiple xsl are created from csv file
This commit is contained in:
Matthias Laug 2013-02-21 14:35:59 +01:00
parent 3ea55ce287
commit 6ae1a501c5

View File

@ -378,9 +378,10 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
*/ */
public function disconnectCells() public function disconnectCells()
{ {
if ( $this->_cellCollection != null ){
$this->_cellCollection->unsetWorksheetCells(); $this->_cellCollection->unsetWorksheetCells();
$this->_cellCollection = NULL; $this->_cellCollection = NULL;
}
// detach ourself from the workbook, so that it can then delete this worksheet successfully // detach ourself from the workbook, so that it can then delete this worksheet successfully
$this->_parent = null; $this->_parent = null;
} }