summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2020-12-19 13:36:57 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-12-19 16:05:41 +0100
commita37f29983f3fee58bde40967667ebae84a6c7537 (patch)
treeca24b49f206980e4b02f3b3c029ecbf2ac26f8fe
parent67d83e40e2c4f3862c50e6abeabfc24a75119fc8 (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>
-rw-r--r--sc/source/core/data/table1.cxx5
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