[Libreoffice-commits] .: sc/source
Kohei Yoshida
kohei at kemper.freedesktop.org
Wed Jan 26 17:25:13 PST 2011
sc/source/ui/view/viewfun2.cxx | 25 ++++++++++++++-----------
1 file changed, 14 insertions(+), 11 deletions(-)
New commits:
commit 910b4c4855385b9f29561f373ddab57b2c45e4fd
Author: Sören Möller <soerenmoeller2001 at gmail.com>
Date: Wed Jan 26 23:48:33 2011 +0100
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.
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index 99a5c9c..130eb17 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);
More information about the Libreoffice-commits
mailing list