diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2020-12-19 13:36:57 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-12-20 09:13:55 +0100 |
commit | 8403a434b93c0a22f9e6b3b7e92ebe920a26874e (patch) | |
tree | 896d7884f855645d9a349efc5a2c8e8e39291a4d | |
parent | 64b3727adb12601d9a4010ec9160a8958d2ee878 (diff) |
fix crash inserting chart
regression from
commit bf4bbc3c2174b21577b8878bc3197923ba44a029
Author: Noel <noelgrandin@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@collabora.co.uk>
(cherry picked from commit a37f29983f3fee58bde40967667ebae84a6c7537)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108001
-rw-r--r-- | sc/source/core/data/table1.cxx | 5 |
1 files changed, 4 insertions, 1 deletions
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 |