From 1f49854c0d18000f52d3ad4525bb52b2f35cc064 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Wed, 24 Apr 2024 09:37:35 +0200 Subject: sc: fix crash in ScColumn::SetEditText() Crashreport: > SIG Fatal signal received: SIGSEGV code: 128 for address: 0x0 > program/libsclo.so > ScColumn::SetEditText(int, std::unique_ptr >) > sc/source/core/data/column3.cxx:2362 > program/libsclo.so > ScTable::SetEditText(short, int, std::unique_ptr >) > /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/unique_ptr.h:395 > program/libsclo.so > ScDocument::SetEditText(ScAddress const&, std::unique_ptr >) > /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/unique_ptr.h:395 > program/libsclo.so > ScDocFunc::SetEditCell(ScAddress const&, EditTextObject const&, bool) > /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/unique_ptr.h:395 > program/libsclo.so > (anonymous namespace)::finalizeFormulaProcessing(std::shared_ptr<(anonymous namespace)::FormulaProcessingContext>) > sc/source/ui/view/viewfunc.cxx:565 Change-Id: I331ca8784702fdcb0ebad6a0a73390dbe2615ece Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166612 Tested-by: Jenkins Reviewed-by: Miklos Vajna (cherry picked from commit e3ce4aad47c052dcd67107f7c91336f4ecc949be) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166526 Reviewed-by: Xisco Fauli (cherry picked from commit 58b85fc5e4ebe6c8a77e2b1935c23bf0ebebad0a) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166848 Tested-by: Michael Stahl Reviewed-by: Michael Stahl Reviewed-by: Eike Rathke --- sc/source/core/data/column3.cxx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index f0f4cc83263b..5a1582e560d7 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -2358,6 +2358,11 @@ bool ScColumn::SetString( SCROW nRow, SCTAB nTabP, const OUString& rString, void ScColumn::SetEditText( SCROW nRow, std::unique_ptr pEditText ) { + if (!pEditText) + { + return; + } + pEditText->NormalizeString(GetDoc().GetSharedStringPool()); std::vector aNewSharedRows; sc::CellStoreType::iterator it = GetPositionToInsert(nRow, aNewSharedRows, false); -- cgit