summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2021-06-19 13:51:28 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2021-06-22 21:45:18 +0200
commit0a8131d098e24842480c9c42b5e47accc7c59ce0 (patch)
tree29c13b63f285d550323974349de7efe27e6a8aa1
parenttdf#139447 crash on dragging query/table from explorer to calc sheet (diff)
downloadcore-0a8131d098e24842480c9c42b5e47accc7c59ce0.tar.gz
core-0a8131d098e24842480c9c42b5e47accc7c59ce0.zip
tdf#142932: fix crash when pasting cells with comments+"skip empty cells"
See bt here: https://bugs.documentfoundation.org/attachment.cgi?id=173011 4 0x00007fc4b0cdbb3d in ScColContainer::operator[](unsigned long) (this=0x872e1e0, nIndex=64) at sc/inc/colcontainer.hxx:43 5 0x00007fc4b120d82b in ScTable::DeleteBeforeCopyFromClip(sc::CopyFromClipContext&, ScTable const&, sc::ColumnSpanSet&) (this=0x872e1e0, rCxt=..., rClipTab=..., rBroadcastSpans=...) at sc/source/core/data/table7.cxx:118 6 0x00007fc4b0e42939 in ScDocument::DeleteBeforeCopyFromClip(sc::CopyFromClipContext&, ScMarkData const&, sc::ColumnSpanSet&) (this=0x3bffa60, rCxt=..., rMark=..., rBroadcastSpans=...) at sc/source/core/data/document10.cxx:75 7 0x00007fc4b0e0b67b in ScDocument::CopyFromClip(ScRange const&, ScMarkData const&, InsertDeleteFlags, ScDocument*, ScDocument*, bool, bool, bool, bool, ScRangeList const*) (this=0x3bffa60, rDestRange=..., rMark=..., nInsFlag=7, pRefUndoDoc=0x0, pClipDoc=0x7d3bb40, bResetCut=true, bAsLink=false, bIncludeFiltered=false, bSkipAttrForEmpty=true, pDestRanges=0x7fff4a3da4b0) at sc/source/core/data/document.cxx:2916 8 0x00007fc4b2412dc3 in ScViewFunc::PasteFromClip(InsertDeleteFlags, ScDocument*, ScPasteFunc, bool, bool, bool, InsCellCmd, InsertDeleteFlags, bool) (this= 0x41a29e0, nFlags=7, pClipDoc=0x7d3bb40, nFunction=ScPasteFunc::NONE, bSkipEmpty=true, bTranspose=false, bAsLink=false, eMoveMode=INS_NONE, nUndoExtraFlags=InsertDeleteFlags::NONE, bAllowDialogs=true) at sc/source/ui/view/viewfun3.cxx:1312 Change-Id: Ic119cb5d414a35a9ba18b0564d7adf83154eb9d7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117497 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> (cherry picked from commit a6d269ed9478b20f611912bf9711c2683e7bc924) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117632 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> (cherry picked from commit bb59b4165456d13eda800098be8b875d93b093d3) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117637
-rw-r--r--sc/source/core/data/table7.cxx3
1 files changed, 2 insertions, 1 deletions
diff --git a/sc/source/core/data/table7.cxx b/sc/source/core/data/table7.cxx
index fc821133ef65..b75751ff7de4 100644
--- a/sc/source/core/data/table7.cxx
+++ b/sc/source/core/data/table7.cxx
@@ -108,7 +108,8 @@ void ScTable::DeleteBeforeCopyFromClip(
ScRange aClipRange = rCxt.getClipDoc()->GetClipParam().getWholeRange();
SCCOL nClipCol = aClipRange.aStart.Col();
{
- for (SCCOL nCol = aRange.mnCol1; nCol <= aRange.mnCol2; ++nCol, ++nClipCol)
+ const SCCOL nMaxCol2 = std::min<SCCOL>( aRange.mnCol2, aCol.size() - 1 );
+ for (SCCOL nCol = aRange.mnCol1; nCol <= nMaxCol2; ++nCol, ++nClipCol)
{
if (nClipCol > aClipRange.aEnd.Col())
nClipCol = aClipRange.aStart.Col(); // loop through columns.