From 47d7260c437921913cc7f6c85716f415df10409d Mon Sep 17 00:00:00 2001 From: Alex Milde Date: Thu, 16 Feb 2017 01:42:07 +0100 Subject: [PATCH] Ignore images with missing data when reading xlsx Ignore images with missing data when reading xlsx Fixes #94, closes #95 --- src/PhpSpreadsheet/Reader/Xlsx.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/PhpSpreadsheet/Reader/Xlsx.php b/src/PhpSpreadsheet/Reader/Xlsx.php index cb787e67..fa100980 100644 --- a/src/PhpSpreadsheet/Reader/Xlsx.php +++ b/src/PhpSpreadsheet/Reader/Xlsx.php @@ -1484,6 +1484,11 @@ class Xlsx extends BaseReader implements IReader foreach ($shapes as $idx => $shape) { $shape->registerXPathNamespace('v', 'urn:schemas-microsoft-com:vml'); $imageData = $shape->xpath('//v:imagedata'); + + if (!$imageData) { + continue; + } + $imageData = $imageData[$idx]; $imageData = $imageData->attributes('urn:schemas-microsoft-com:office:office');