From 9e170a35eebbe86e6137510bc8ea34e5a45dbd8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Thu, 23 Jun 2022 16:39:39 +0200 Subject: [PATCH] handle nullptr SharedString in ScQueryEvaluator (tdf#149679) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This may be the case if the string comes from ScMatrix::Get() for ScMatValType::Empty. Change-Id: I35013449611bf7ffd1bc74e023d76597af010724 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136347 Tested-by: Jenkins Reviewed-by: Luboš Luňák --- sc/source/core/data/queryevaluator.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sc/source/core/data/queryevaluator.cxx b/sc/source/core/data/queryevaluator.cxx index 4e35eeffcd62..d0b30a9942fd 100644 --- a/sc/source/core/data/queryevaluator.cxx +++ b/sc/source/core/data/queryevaluator.cxx @@ -491,8 +491,9 @@ std::pair ScQueryEvaluator::compareByString(const ScQueryEntry& rEnt const rtl_uString* pQuer = rItem.maString.getDataIgnoreCase(); const rtl_uString* pCellStr = rSource.getDataIgnoreCase(); - assert(pQuer != nullptr); assert(pCellStr != nullptr); + if (pQuer == nullptr) + pQuer = svl::SharedString::getEmptyString().getDataIgnoreCase(); const sal_Int32 nIndex = (rEntry.eOp == SC_ENDS_WITH || rEntry.eOp == SC_DOES_NOT_END_WITH)