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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Mon Nov 18 18:31:06 UTC 2019


 sc/source/core/data/table2.cxx |   21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

New commits:
commit 00e1adec49c50f9128dd02ae721e62ae3e729ad6
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Nov 18 15:35:18 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Nov 18 19:29:46 2019 +0100

    crashtesting fdo78617-2.ods
    
    as a consequence of
            commit feec8e3c34e08b621098a17f1011dccd0b4f7f4c
            Date:   Tue Nov 12 16:00:55 2019 +0200
        reduce iteration in ScViewData::GetScrPos
    
    Change-Id: Iec539c33bd80b9ad2d2a3698d443c5cec81f8f85
    Reviewed-on: https://gerrit.libreoffice.org/83093
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index f1a0f37dcbbf..4069f163e163 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -3270,17 +3270,20 @@ sal_uLong ScTable::GetScaledRowHeight( SCROW nStartRow, SCROW nEndRow, double fS
 
                     // round-down a single height value, multiply resulting (pixel) values
                     const sal_uLong nOneHeight = static_cast<sal_uLong>( aData.mnValue * fScale );
-                    SCROW nRowsInSegment = nSegmentEnd + 1 - nRow;
-                    if (pnMaxHeight)
+                    // sometimes scaling results in zero height
+                    if (nOneHeight)
                     {
-                        nRowsInSegment = std::min(nRowsInSegment, static_cast<SCROW>(*pnMaxHeight / nOneHeight + 1));
-                        nHeight += nOneHeight * nRowsInSegment;
-                        if (nHeight > *pnMaxHeight)
-                            return nHeight;
+                        SCROW nRowsInSegment = nSegmentEnd + 1 - nRow;
+                        if (pnMaxHeight)
+                        {
+                            nRowsInSegment = std::min(nRowsInSegment, static_cast<SCROW>(*pnMaxHeight / nOneHeight + 1));
+                            nHeight += nOneHeight * nRowsInSegment;
+                            if (nHeight > *pnMaxHeight)
+                                return nHeight;
+                        }
+                        else
+                            nHeight += nOneHeight * nRowsInSegment;
                     }
-                    else
-                        nHeight += nOneHeight * nRowsInSegment;
-
 
                     nRow = nSegmentEnd + 1;
                 }


More information about the Libreoffice-commits mailing list