summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/source/core/data/column.cxx7
1 files changed, 5 insertions, 2 deletions
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index ad156efa9507..ac5f1d581c12 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -1245,8 +1245,11 @@ void ScColumn::CopyStaticToDocument(SCROW nRow1, SCROW nRow2, ScColumn& rDestCol
// Determine the range of cells in the original column that need to be copied.
it = std::find_if(maItems.begin(), maItems.end(), FindInRows(nRow1, nRow2));
- if (it != maItems.end())
- itEnd = std::find_if(it, maItems.end(), FindAboveRow(nRow2));
+ if (it == maItems.end())
+ // Nothing to copy.
+ return;
+
+ itEnd = std::find_if(it, maItems.end(), FindAboveRow(nRow2));
// Clone and staticize all cells that need to be copied.
std::vector<ColEntry> aCopied;