From bc908eb37e4cb1a37a1123ed141a6999760a6343 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sat, 12 Sep 2020 16:34:07 +0100 Subject: ScDBQueryDataIterator is never passed a null ScDocument MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ibcf9e6c212186fe1f8bc9d03413e4efc423c62d3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102527 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- sc/inc/dociter.hxx | 2 +- sc/source/core/data/dociter.cxx | 4 ++-- sc/source/core/tool/interpr1.cxx | 8 ++++---- 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 mpData; public: - ScDBQueryDataIterator(ScDocument* pDocument, const ScInterpreterContext& rContext, std::unique_ptr pParam); + ScDBQueryDataIterator(ScDocument& rDocument, const ScInterpreterContext& rContext, std::unique_ptr 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 pParam) : +ScDBQueryDataIterator::ScDBQueryDataIterator(ScDocument& rDocument, const ScInterpreterContext& rContext, std::unique_ptr 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(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) { -- cgit