From 23e19a2d47da150aa138ab462cfa7684418e3b7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Mourey?= Date: Mon, 12 Sep 2016 16:43:21 +0200 Subject: [PATCH] Fix division by zero See #886 --- src/PhpWord/Writer/ODText/Style/Paragraph.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PhpWord/Writer/ODText/Style/Paragraph.php b/src/PhpWord/Writer/ODText/Style/Paragraph.php index 1d821810..494142d7 100644 --- a/src/PhpWord/Writer/ODText/Style/Paragraph.php +++ b/src/PhpWord/Writer/ODText/Style/Paragraph.php @@ -37,8 +37,8 @@ class Paragraph extends AbstractStyle } $xmlWriter = $this->getXmlWriter(); - $marginTop = is_null($style->getSpaceBefore()) ? '0' : round(17.6 / $style->getSpaceBefore(), 2); - $marginBottom = is_null($style->getSpaceAfter()) ? '0' : round(17.6 / $style->getSpaceAfter(), 2); + $marginTop = ($style->getSpaceBefore()==0) ? '0' : round(17.6 / $style->getSpaceBefore(), 2); + $marginBottom = ($style->getSpaceAfter()==0) ? '0' : round(17.6 / $style->getSpaceAfter(), 2); $xmlWriter->startElement('style:style'); $xmlWriter->writeAttribute('style:name', $style->getStyleName());