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
commit59e0fc84462b6aafb4e2d658a4d60a9388bd6265 (patch)
tree4054bffc34927cdd46e7c7aab058a70d5ac729be
parent987c0541f9aad630cfff2c8eaf46ab884ab4502d (diff)
Added check for empty rRangeList in ScViewFunc
This fixes a crash, which occured when the sum function was called, without beeing able to generate an automatic range.
Notes
split repo tag: calc_LO-BASE-INTEGRATION-DEV300_m98
-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 17504f88f3fa..6cc498991e36 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);