diff --git a/Classes/PHPExcel/Worksheet.php b/Classes/PHPExcel/Worksheet.php index c8b70fe..c9830fc 100644 --- a/Classes/PHPExcel/Worksheet.php +++ b/Classes/PHPExcel/Worksheet.php @@ -378,9 +378,10 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable */ public function disconnectCells() { - $this->_cellCollection->unsetWorksheetCells(); - $this->_cellCollection = NULL; - + if ( $this->_cellCollection != null ){ + $this->_cellCollection->unsetWorksheetCells(); + $this->_cellCollection = NULL; + } // detach ourself from the workbook, so that it can then delete this worksheet successfully $this->_parent = null; }