tdf#141405 fix null reference use crash
Change-Id: I90906b7df044c1a139c6187b74d1b4b8210919c2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113434
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
diff --git a/svx/source/svdraw/svdedtv.cxx b/svx/source/svdraw/svdedtv.cxx
index c49474c..3470a8d 100644
--- a/svx/source/svdraw/svdedtv.cxx
+++ b/svx/source/svdraw/svdedtv.cxx
@@ -1005,8 +1005,8 @@ bool SdrEditView::InsertObjectAtView(SdrObject* pObj, SdrPageView& rPV, SdrInser
css::uno::Reference<lang::XServiceInfo> xServices(GetModel()->getUnoModel(),
css::uno::UNO_QUERY);
if (xServices->supportsService("com.sun.star.sheet.SpreadsheetDocument") ||
xServices->supportsService("com.sun.star.text.TextDocument"))
if (xServices.is() && (xServices->supportsService("com.sun.star.sheet.SpreadsheetDocument") ||
xServices->supportsService("com.sun.star.text.TextDocument")))
{
const bool bUndo(IsUndoEnabled());
GetModel()->EnableUndo(false);