Kaydet (Commit) 5aa299c0 authored tarafından Julien Nabet's avatar Julien Nabet Kaydeden (comit) Michael Stahl

fdo#85562: sw: fix crash on insert of input field and set variable field

When a new field is inserted it doesn't have a SwFmtFld yet and it is
also not yet in the document so it is not necessary to listen for its
deletion.

(regression from bbd97fe5)

Change-Id: I23c18aa8c490a6ad1de63a33f87679cc2358d7f5
üst 9b7542b0
......@@ -211,24 +211,24 @@ bool SwWrtShell::StartInputFldDlg( SwField* pFld, bool bNextButton,
FieldDeletionModify aModify(pDlg.get());
SwInputField *const pInputField(dynamic_cast<SwInputField*>(pFld));
SwSetExpField *const pSetExpFld(dynamic_cast<SwSetExpField*>(pFld));
if (pInputField)
if (pInputField && pInputField->GetFmtFld())
{
// Register for possible input field deletion while dialog is open
pInputField->GetFmtFld()->Add(&aModify);
}
else if (pSetExpFld)
else if (pSetExpFld && pSetExpFld->GetFmtFld())
{
pSetExpFld->GetFmtFld()->Add(&aModify);
}
bool bRet = RET_CANCEL == pDlg->Execute();
if (pInputField)
if (pInputField && pInputField->GetFmtFld())
{
// Dialog closed, remove modification listener
pInputField->GetFmtFld()->Remove(&aModify);
}
else if (pSetExpFld)
else if (pSetExpFld && pSetExpFld->GetFmtFld())
{
pSetExpFld->GetFmtFld()->Remove(&aModify);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment