diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-09-12 16:34:07 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-09-13 15:16:38 +0200 |
commit | bc908eb37e4cb1a37a1123ed141a6999760a6343 (patch) | |
tree | fae8873b46283171fdbd0111a3bd47349f63c6f2 | |
parent | d08ac694a60af612fe603e90eb60d25a1ce290c8 (diff) |
ScDBQueryDataIterator is never passed a null ScDocument
Change-Id: Ibcf9e6c212186fe1f8bc9d03413e4efc423c62d3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102527
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | sc/inc/dociter.hxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/dociter.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/tool/interpr1.cxx | 8 | ||||
-rw-r--r-- | sc/source/core/tool/interpr4.cxx | 2 |
4 files changed, 8 insertions, 8 deletions
diff --git a/sc/inc/dociter.hxx b/sc/inc/dociter.hxx index 7727a67faa5a..1418b0facfb2 100644 --- a/sc/inc/dociter.hxx +++ b/sc/inc/dociter.hxx @@ -178,7 +178,7 @@ private: ::std::unique_ptr<DataAccess> mpData; public: - ScDBQueryDataIterator(ScDocument* pDocument, const ScInterpreterContext& rContext, std::unique_ptr<ScDBQueryParamBase> pParam); + ScDBQueryDataIterator(ScDocument& rDocument, const ScInterpreterContext& rContext, std::unique_ptr<ScDBQueryParamBase> pParam); /// Does NOT reset rValue if no value found! bool GetFirst(Value& rValue); /// Does NOT reset rValue if no value found! diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx index 7b5b6f9d83f4..368ddedc79b4 100644 --- a/sc/source/core/data/dociter.cxx +++ b/sc/source/core/data/dociter.cxx @@ -750,7 +750,7 @@ ScDBQueryDataIterator::Value::Value() : ::rtl::math::setNan(&mfValue); } -ScDBQueryDataIterator::ScDBQueryDataIterator(ScDocument* pDocument, const ScInterpreterContext& rContext, std::unique_ptr<ScDBQueryParamBase> pParam) : +ScDBQueryDataIterator::ScDBQueryDataIterator(ScDocument& rDocument, const ScInterpreterContext& rContext, std::unique_ptr<ScDBQueryParamBase> pParam) : mpParam (std::move(pParam)) { switch (mpParam->GetType()) @@ -758,7 +758,7 @@ ScDBQueryDataIterator::ScDBQueryDataIterator(ScDocument* pDocument, const ScInte case ScDBQueryParamBase::INTERNAL: { ScDBQueryParamInternal* p = static_cast<ScDBQueryParamInternal*>(mpParam.get()); - mpData.reset(new DataAccessInternal(p, pDocument, rContext)); + mpData.reset(new DataAccessInternal(p, &rDocument, rContext)); } break; case ScDBQueryParamBase::MATRIX: diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index f52475378abf..b4c66860c3ea 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -7820,7 +7820,7 @@ void ScInterpreter::DBIterator( ScIterFunc eFunc ) SetError(FormulaError::NoValue); return; } - ScDBQueryDataIterator aValIter(&mrDoc, mrContext, std::move(pQueryParam)); + ScDBQueryDataIterator aValIter(mrDoc, mrContext, std::move(pQueryParam)); ScDBQueryDataIterator::Value aValue; if ( aValIter.GetFirst(aValue) && aValue.mnError == FormulaError::NONE ) { @@ -7924,7 +7924,7 @@ void ScInterpreter::ScDBCount() SetError(FormulaError::NoValue); return; } - ScDBQueryDataIterator aValIter( &mrDoc, mrContext, std::move(pQueryParam)); + ScDBQueryDataIterator aValIter(mrDoc, mrContext, std::move(pQueryParam)); ScDBQueryDataIterator::Value aValue; if ( aValIter.GetFirst(aValue) && aValue.mnError == FormulaError::NONE ) { @@ -7955,7 +7955,7 @@ void ScInterpreter::ScDBCount2() } sal_uLong nCount = 0; pQueryParam->mbSkipString = false; - ScDBQueryDataIterator aValIter( &mrDoc, mrContext, std::move(pQueryParam)); + ScDBQueryDataIterator aValIter(mrDoc, mrContext, std::move(pQueryParam)); ScDBQueryDataIterator::Value aValue; if ( aValIter.GetFirst(aValue) && aValue.mnError == FormulaError::NONE ) { @@ -8009,7 +8009,7 @@ void ScInterpreter::GetDBStVarParams( double& rVal, double& rValCount ) SetError(FormulaError::NoValue); return; } - ScDBQueryDataIterator aValIter(&mrDoc, mrContext, std::move(pQueryParam)); + ScDBQueryDataIterator aValIter(mrDoc, mrContext, std::move(pQueryParam)); ScDBQueryDataIterator::Value aValue; if (aValIter.GetFirst(aValue) && aValue.mnError == FormulaError::NONE) { diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx index 1d5b37fff09b..367824956cea 100644 --- a/sc/source/core/tool/interpr4.cxx +++ b/sc/source/core/tool/interpr4.cxx @@ -2491,7 +2491,7 @@ void ScInterpreter::ScDBGet() } pQueryParam->mbSkipString = false; - ScDBQueryDataIterator aValIter(&mrDoc, mrContext, std::move(pQueryParam)); + ScDBQueryDataIterator aValIter(mrDoc, mrContext, std::move(pQueryParam)); ScDBQueryDataIterator::Value aValue; if (!aValIter.GetFirst(aValue) || aValue.mnError != FormulaError::NONE) { |