[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sc/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Sun Dec 20 08:14:28 UTC 2020


 sc/source/core/data/table1.cxx |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 8403a434b93c0a22f9e6b3b7e92ebe920a26874e
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Sat Dec 19 13:36:57 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sun Dec 20 09:13:55 2020 +0100

    fix crash inserting chart
    
    regression from
        commit bf4bbc3c2174b21577b8878bc3197923ba44a029
        Author: Noel <noelgrandin at gmail.com>
        Date:   Thu Nov 12 15:38:13 2020 +0200
        replace std::max(std::min()) with std::clamp
    
    Thanks to Leyan Ouyang for debugging this.
    
    Change-Id: Iafd6d47c1974be2cd55f76aa1fc5f4f614a8d093
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108020
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    (cherry picked from commit a37f29983f3fee58bde40967667ebae84a6c7537)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108001

diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index d0451b4f2542..19ddf61770de 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -1164,7 +1164,10 @@ void ScTable::LimitChartArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol
     SCROW lastDataPos = 0;
     for (SCCOL i=rStartCol; i<=rEndCol; i++)
         lastDataPos = std::max(lastDataPos, aCol[i].GetLastDataPos());
-    rEndRow = std::clamp( rEndRow, rStartRow, lastDataPos );
+    // reduce EndRow to the last row with data
+    rEndRow = std::min(rEndRow, lastDataPos);
+    // but make sure EndRow is >= StartRow
+    rEndRow = std::max(rStartRow, rEndRow);
 }
 
 SCCOL ScTable::FindNextVisibleCol( SCCOL nCol, bool bRight ) const


More information about the Libreoffice-commits mailing list