Skip to content

Commit 6ae1a50

Browse files
committed
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
1 parent 3ea55ce commit 6ae1a50

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Classes/PHPExcel/Worksheet.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -378,9 +378,10 @@ public function __construct(PHPExcel $pParent = null, $pTitle = 'Worksheet')
378378
*/
379379
public function disconnectCells()
380380
{
381-
$this->_cellCollection->unsetWorksheetCells();
382-
$this->_cellCollection = NULL;
383-
381+
if ( $this->_cellCollection != null ){
382+
$this->_cellCollection->unsetWorksheetCells();
383+
$this->_cellCollection = NULL;
384+
}
384385
// detach ourself from the workbook, so that it can then delete this worksheet successfully
385386
$this->_parent = null;
386387
}

0 commit comments

Comments
 (0)