diff options
author | Kohei Yoshida <kyoshida@novell.com> | 2011-05-24 15:49:55 -0400 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2011-05-24 22:53:39 +0200 |
commit | 226c30f2a6cdb5be63b62f0d65577bf6550f3fa8 (patch) | |
tree | 047d7ab461754ac7dc47bda55e1c1a87d457c5c5 | |
parent | 465a643dfcd49d79f434c4959ead7b8bda39d88c (diff) |
fdo#37520: Don't cache the array size but query it dynamically.
The size of the array may change during the loop, so we need to always
query it dynamically via size() instead of caching it at the beginning
of the loop.
Signed-off-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
-rw-r--r-- | sc/source/core/tool/rangelst.cxx | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sc/source/core/tool/rangelst.cxx b/sc/source/core/tool/rangelst.cxx index 0a92d6383..572472e0d 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 ) |