From 07674a32af695801e0f69fedd685680ccbe5ab6f Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Fri, 10 Oct 2025 16:44:14 +0200 Subject: [PATCH] tdf#51850 sw: fix a nullpointer crash lcl_PasteFlyOrDrawFormat() may return nullptr, causing testTdf155028 to crash in older release branch. (regression from commit d072b5e09e1c7f759c797b7ba1ee89a3bfef8858) Change-Id: I68549648aef2c9d58919f4d26415834d0784eeef Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192173 Reviewed-by: Michael Stahl Tested-by: Jenkins --- sw/source/core/frmedt/fecopy.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx index c0ee3c3f6e1c..ee28fb587a26 100644 --- a/sw/source/core/frmedt/fecopy.cxx +++ b/sw/source/core/frmedt/fecopy.cxx @@ -1079,7 +1079,7 @@ SwFEShell::Paste(SwDoc& rClpDoc, bool const bNestedTable) { lcl_InitSelectFlyOrDrawFormat(pFlyFormat, *this, isSelect); } - if (isSelect && inserted.size() == 1) + if (isSelect && inserted.size() == 1 && inserted.front()) { if (inserted.front()->Which() == RES_FLYFRMFMT && GetDoc()->GetNodes()[inserted.front()->GetContent().GetContentIdx()->GetIndex() + 1]->IsGrfNode())