tdf#51850 sw: fix a nullpointer crash

lcl_PasteFlyOrDrawFormat() may return nullptr, causing testTdf155028 to
crash in older release branch.

(regression from commit d072b5e09e)

Change-Id: I68549648aef2c9d58919f4d26415834d0784eeef
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192173
Reviewed-by: Michael Stahl <michael.stahl@collabora.com>
Tested-by: Jenkins
This commit is contained in:
Michael Stahl
2025-10-13 11:04:51 +02:00
parent f042c34f6d
commit 07674a32af
+1 -1
View File
@@ -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())