Skip to content

Commit 23e19a2

Browse files
author
Stéphane Mourey
authored
Fix division by zero
See #886
1 parent c710690 commit 23e19a2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/PhpWord/Writer/ODText/Style/Paragraph.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ public function write()
3737
}
3838
$xmlWriter = $this->getXmlWriter();
3939

40-
$marginTop = is_null($style->getSpaceBefore()) ? '0' : round(17.6 / $style->getSpaceBefore(), 2);
41-
$marginBottom = is_null($style->getSpaceAfter()) ? '0' : round(17.6 / $style->getSpaceAfter(), 2);
40+
$marginTop = ($style->getSpaceBefore()==0) ? '0' : round(17.6 / $style->getSpaceBefore(), 2);
41+
$marginBottom = ($style->getSpaceAfter()==0) ? '0' : round(17.6 / $style->getSpaceAfter(), 2);
4242

4343
$xmlWriter->startElement('style:style');
4444
$xmlWriter->writeAttribute('style:name', $style->getStyleName());

0 commit comments

Comments
 (0)