[Libreoffice-commits] core.git: sfx2/source sw/source

Caolán McNamara caolanm at redhat.com
Wed Mar 7 13:45:44 UTC 2018


 sfx2/source/doc/new.cxx        |    2 +-
 sw/source/uibase/app/docsh.cxx |    2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 87dd08660836bfe38d4ec309363d897210f4afb8
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Mar 7 10:56:39 2018 +0000

    preview of empty page ends up with negative size
    
    in load templates, i.e. SfxPreviewWin_Impl, with
    an empty writer template selected.
    
    Change-Id: I7194def1dacb25e39416532ed91addc1de0c1d39
    Reviewed-on: https://gerrit.libreoffice.org/50877
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sfx2/source/doc/new.cxx b/sfx2/source/doc/new.cxx
index 9c363b02e17b..67c6b73a31da 100644
--- a/sfx2/source/doc/new.cxx
+++ b/sfx2/source/doc/new.cxx
@@ -82,7 +82,7 @@ void SfxPreviewWin_Impl::ImpPaint(vcl::RenderContext& rRenderContext, GDIMetaFil
     if (nWidth <= 0 || nHeight <= 0)
         return;
 
-    double dRatio = double(aTmpSize.Width()) / aTmpSize.Height();
+    double dRatio = aTmpSize.Height() ? (double(aTmpSize.Width()) / aTmpSize.Height()) : 1;
     double dRatioPreV = double(nWidth) / nHeight;
     Size aSize;
     Point aPoint;
diff --git a/sw/source/uibase/app/docsh.cxx b/sw/source/uibase/app/docsh.cxx
index 9291e0a2f763..be9438ceae71 100644
--- a/sw/source/uibase/app/docsh.cxx
+++ b/sw/source/uibase/app/docsh.cxx
@@ -890,6 +890,8 @@ tools::Rectangle SwDocShell::GetVisArea( sal_uInt16 nAspect ) const
         SwContentNode* pNd = m_xDoc->GetNodes().GoNext( &aIdx );
 
         const SwRect aPageRect = pNd->FindPageFrameRect();
+        if (aPageRect.IsEmpty())
+            return tools::Rectangle();
         tools::Rectangle aRect(aPageRect.SVRect());
 
         // tdf#81219 sanitize - nobody is interested in a thumbnail where's


More information about the Libreoffice-commits mailing list