summaryrefslogtreecommitdiff
path: root/sc/source/core/tool/rangelst.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/core/tool/rangelst.cxx')
-rw-r--r--sc/source/core/tool/rangelst.cxx4
1 files changed, 3 insertions, 1 deletions
diff --git a/sc/source/core/tool/rangelst.cxx b/sc/source/core/tool/rangelst.cxx
index 7395da73d33e..9b43b635823e 100644
--- a/sc/source/core/tool/rangelst.cxx
+++ b/sc/source/core/tool/rangelst.cxx
@@ -260,7 +260,9 @@ void ScRangeList::Join( const ScRange& r, bool bIsInList )
}
bool bJoinedInput = false;
- for ( size_t i = 0, nRanges = maRanges.size(); i < nRanges && pOver; ++i )
+ // We need to query the size of the container dynamically since its size
+ // may change during the loop.
+ for ( size_t i = 0; i < maRanges.size() && pOver; ++i )
{
ScRange* p = maRanges[i];
if ( p == pOver )