summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSören Möller <soerenmoeller2001@gmail.com>2011-01-26 23:48:33 +0100
committerKohei Yoshida <kyoshida@novell.com>2011-01-26 20:24:54 -0500
commit910b4c4855385b9f29561f373ddab57b2c45e4fd (patch)
treea5d33f70c726ee6917d8caad4e0125709d85af70
parentae1ae396bd7ad8b00d2f27bcde7a2a600e0b9497 (diff)
Added check for empty rRangeList in ScViewFuncLO-BASE-INTEGRATION-DEV300_m98
This fixes a crash, which occured when the sum function was called, without beeing able to generate an automatic range.
-rw-r--r--sc/source/ui/view/viewfun2.cxx25
1 files changed, 14 insertions, 11 deletions
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index 99a5c9ca0..130eb17f2 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -744,17 +744,20 @@ String ScViewFunc::GetAutoSumFormula( const ScRangeList& rRangeList, bool bSubTo
pArray->AddOpCode(ocSep);
}
- ScRangeList aRangeList = rRangeList;
- const ScRange* pFirst = aRangeList.front();
- size_t ListSize = aRangeList.size();
- for ( size_t i = 0; i < ListSize; ++i )
- {
- const ScRange* p = aRangeList[i];
- if (p != pFirst)
- pArray->AddOpCode(ocSep);
- ScComplexRefData aRef;
- aRef.InitRangeRel(*p, rAddr);
- pArray->AddDoubleReference(aRef);
+ if(!rRangeList.empty())
+ {
+ ScRangeList aRangeList = rRangeList;
+ const ScRange* pFirst = aRangeList.front();
+ size_t ListSize = aRangeList.size();
+ for ( size_t i = 0; i < ListSize; ++i )
+ {
+ const ScRange* p = aRangeList[i];
+ if (p != pFirst)
+ pArray->AddOpCode(ocSep);
+ ScComplexRefData aRef;
+ aRef.InitRangeRel(*p, rAddr);
+ pArray->AddDoubleReference(aRef);
+ }
}
pArray->AddOpCode(ocClose);