[Libreoffice-commits] core.git: lotuswordpro/source

Caolán McNamara caolanm at redhat.com
Fri Jan 5 20:57:57 UTC 2018


 lotuswordpro/source/filter/lwppagelayout.cxx |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

New commits:
commit 9fff5632a91c8d396116565162cf0a5b4fa9875f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Jan 5 20:54:59 2018 +0000

    ofz#4879 Divide-by-zero
    
    Change-Id: I0df4bc2c8d9c5d5f95141b585826fc773a1fde3e
    Reviewed-on: https://gerrit.libreoffice.org/47484
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/lotuswordpro/source/filter/lwppagelayout.cxx b/lotuswordpro/source/filter/lwppagelayout.cxx
index fc5d77ab90de..193bdbbedb69 100644
--- a/lotuswordpro/source/filter/lwppagelayout.cxx
+++ b/lotuswordpro/source/filter/lwppagelayout.cxx
@@ -63,6 +63,7 @@
 #include "lwppagehint.hxx"
 #include "lwpdivinfo.hxx"
 #include "lwpstory.hxx"
+#include <o3tl/numeric.hxx>
 #include <xfilter/xfstylemanager.hxx>
 #include <xfilter/xfmasterpage.hxx>
 #include <xfilter/xfcontentcontainer.hxx>
@@ -273,8 +274,12 @@ void LwpPageLayout::ParseFootNoteSeparator(XFPageMaster * pm1)
             }
             if(rFootnoteSep.HasCustomLength())
             {
-                nLengthPercent =  static_cast<sal_uInt32>(100*LwpTools::ConvertFromUnitsToMetric(rFootnoteSep.GetLength())/GetMarginWidth());
-                if(nLengthPercent > 100)
+                const double fMarginWidth = GetMarginWidth();
+                if (fMarginWidth == 0.0)
+                    throw o3tl::divide_by_zero();
+
+                nLengthPercent =  static_cast<sal_uInt32>(100*LwpTools::ConvertFromUnitsToMetric(rFootnoteSep.GetLength()) / fMarginWidth);
+                if (nLengthPercent > 100)
                     nLengthPercent = 100;
             }
             double fAbove = LwpTools::ConvertFromUnitsToMetric(rFootnoteSep.GetAbove());


More information about the Libreoffice-commits mailing list