From 6ae1a501c5cf0a821f155c382118340e3a6e2c35 Mon Sep 17 00:00:00 2001 From: Matthias Laug Date: Thu, 21 Feb 2013 14:35:59 +0100 Subject: [PATCH] Fatal Error on non object in Worksheet.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- Classes/PHPExcel/Worksheet.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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; }