From 2469e69af85bb5fa03f38f85801f4cdda29e5f54 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Fri, 20 Sep 2024 13:47:06 +0500 Subject: [PATCH] Make sure to have a graphic here Commit 8872f7121b4ae4dd0b51820366d3510a88f7aac2 (crashtesting: crash on exporting kde274105-6.docx to .rtf, 2024-03-27) made sure to provide a graphic in all cases, to avoid crashes revealed by crashtesting. In commit f317746f55044927a180657f81e21d662102b0c5, I removed that. This reinstates the safety measure for cases when there's no graphic yet. Change-Id: Ida3eecd5c7ccff087c2ca8b6076ca01b8a145adc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173697 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- svtools/source/misc/embedhlp.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/svtools/source/misc/embedhlp.cxx b/svtools/source/misc/embedhlp.cxx index 63f1e366a945..9e14fb5d37a8 100644 --- a/svtools/source/misc/embedhlp.cxx +++ b/svtools/source/misc/embedhlp.cxx @@ -477,6 +477,10 @@ void EmbeddedObjectRef::GetReplacement( bool bUpdate ) return; } + // Missing graphic can crash + if (!mpImpl->oGraphic) + mpImpl->oGraphic.emplace(); + std::unique_ptr pGraphicStream(GetGraphicStream( bUpdate )); if (!pGraphicStream && aOldGraphic.IsNone()) {