sc/source/ui/view/formatsh.cxx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
New commits: commit a2f9bdaf03733651a3d3fec6543eb690f59a8986 Author: Andras Timar <[email protected]> AuthorDate: Mon Feb 23 08:20:03 2026 +0100 Commit: Andras Timar <[email protected]> CommitDate: Mon Feb 23 15:38:57 2026 +0100 use HasItem for SID_FRAME_LINESTYLE to avoid crash SfxItemSet::Get(SID_FRAME_LINESTYLE) crashes when the SvxLineItem is not in the argument set AND SID_FRAME_LINESTYLE (10201) is not in any Calc pool's Which ID range - getTargetPool() returns nullptr in GetUserOrPoolDefaultItem(), causing a null pointer dereference. This can happen when LOKit dispatches .uno:LineStyle with arguments in a format that TransformParameters cannot convert to SvxLineItem (e.g. simple integer values instead of BorderLine2 struct), so the item is never put into the set. Use HasItem() to safely check for the item's presence, and also guard the FN_PARAM branch against null pLine. Change-Id: Iad2421ec63c93f0a4223b6f573d3c1d8e9ec3863 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200008 Reviewed-by: Andras Timar <[email protected]> Tested-by: Jenkins CollaboraOffice <[email protected]> diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx index db38ab68189b..344959b911f6 100644 --- a/sc/source/ui/view/formatsh.cxx +++ b/sc/source/ui/view/formatsh.cxx @@ -1066,10 +1066,14 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq ) { // Update default line ::editeng::SvxBorderLine aLine; - const ::editeng::SvxBorderLine* pLine = pNewAttrs->Get(SID_FRAME_LINESTYLE).GetLine(); + const ::editeng::SvxBorderLine* pLine = nullptr; + const SfxPoolItem* pLineStyleItem = nullptr; + if (pNewAttrs->HasItem(SID_FRAME_LINESTYLE, &pLineStyleItem)) + pLine = static_cast<const SvxLineItem*>(pLineStyleItem)->GetLine(); const SfxPoolItem *pItem1, *pItem2, *pItem3; - if (pNewAttrs->HasItem(FN_PARAM_1, &pItem1) && + if (pLine && + pNewAttrs->HasItem(FN_PARAM_1, &pItem1) && pNewAttrs->HasItem(FN_PARAM_2, &pItem2) && pNewAttrs->HasItem(FN_PARAM_3, &pItem3)) {
