diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2021-04-08 10:12:16 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2021-04-08 10:40:57 +0200 |
commit | a0d2fb3217094aa7158310f0bcf16093bcc4984f (patch) | |
tree | eb0cdbe2b1ac502acb0ce0dd7b2de37de2475270 /sc/source | |
parent | a4d69d2a7680d4c8062119d2b9dab1df7c2b574d (diff) |
tdf#141547: maQueryItems can be 0
E.g., fillQueryParam (sc/source/ui/unoobj/datauno.cxx) may clear it
and leave empty if relevant input item is empty.
Note how commit e4b924df8f9ad02c66549751cb8e123e420e8508 had changed
the same checks in ScQueryEntry::IsQueryBy[Non]Empty.
Change-Id: I552462c72e69ddce43711bcff645dc6c7b133db7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113783
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/core/tool/queryentry.cxx | 12 | ||||
-rw-r--r-- | sc/source/ui/dbgui/filtdlg.cxx | 2 |
2 files changed, 3 insertions, 11 deletions
diff --git a/sc/source/core/tool/queryentry.cxx b/sc/source/core/tool/queryentry.cxx index 465bbd805e03..a295759e0c3c 100644 --- a/sc/source/core/tool/queryentry.cxx +++ b/sc/source/core/tool/queryentry.cxx @@ -115,17 +115,9 @@ bool ScQueryEntry::IsQueryByNonEmpty() const rItem.mfVal == SC_NONEMPTYFIELDS; } -const ScQueryEntry::Item& ScQueryEntry::GetQueryItem() const +ScQueryEntry::Item& ScQueryEntry::GetQueryItemImpl() const { - if (maQueryItems.size() > 1) - // Reset to a single query mode. - maQueryItems.resize(1); - return maQueryItems[0]; -} - -ScQueryEntry::Item& ScQueryEntry::GetQueryItem() -{ - if (maQueryItems.size() > 1) + if (maQueryItems.size() != 1) // Reset to a single query mode. maQueryItems.resize(1); return maQueryItems[0]; diff --git a/sc/source/ui/dbgui/filtdlg.cxx b/sc/source/ui/dbgui/filtdlg.cxx index 13f9fff9381a..322c617aa2f9 100644 --- a/sc/source/ui/dbgui/filtdlg.cxx +++ b/sc/source/ui/dbgui/filtdlg.cxx @@ -221,7 +221,6 @@ void ScFilterDlg::Init( const SfxItemSet& rArgSet ) ScQueryEntry& rEntry = theQueryData.GetEntry(i); if ( rEntry.bDoQuery ) { - const ScQueryEntry::Item& rItem = rEntry.GetQueryItem(); nCondPos = static_cast<size_t>(rEntry.eOp); nFieldSelPos = GetFieldSelPos( static_cast<SCCOL>(rEntry.nField) ); if (rEntry.IsQueryByEmpty()) @@ -236,6 +235,7 @@ void ScFilterDlg::Init( const SfxItemSet& rArgSet ) } else { + const ScQueryEntry::Item& rItem = rEntry.GetQueryItem(); OUString aQueryStr = rItem.maString.getString(); SetValString(aQueryStr, rItem, aValStr); } |