diff --git a/sw/source/uibase/shells/textfld.cxx b/sw/source/uibase/shells/textfld.cxx index 53fd4471ce37..d8da30749cc7 100644 --- a/sw/source/uibase/shells/textfld.cxx +++ b/sw/source/uibase/shells/textfld.cxx @@ -462,13 +462,17 @@ void SwTextShell::ExecField(SfxRequest &rReq) pMgr->RegisterAnswerText(sText); pWin->ExecuteCommand(nSlot); - // Set the parent postit id of the reply. - GetView().GetPostItMgr()->GetLatestPostItField()->SetParentPostItId(pIdItem->GetValue().toUInt32()); + SwPostItField* pLatestPostItField = pMgr->GetLatestPostItField(); + if (pLatestPostItField) + { + // Set the parent postit id of the reply. + pLatestPostItField->SetParentPostItId(pIdItem->GetValue().toUInt32()); - // If name of the replied comment is empty, we need to set a name in order to connect them in the xml file. - pWin->GeneratePostItName(); // Generates a name if the current name is empty. + // If name of the replied comment is empty, we need to set a name in order to connect them in the xml file. + pWin->GeneratePostItName(); // Generates a name if the current name is empty. - GetView().GetPostItMgr()->GetLatestPostItField()->SetParentName(pWin->GetPostItField()->GetName()); + pLatestPostItField->SetParentName(pWin->GetPostItField()->GetName()); + } } } }