From 0275a73f31efad4ca385a93be173b2cc6921d18d Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Fri, 12 Jan 2018 00:10:08 +0000 Subject: [PATCH] frmContactEditor: Check for parent window before sending update event --- .../contacteditor/frmContactEditor-Save.cpp | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/source/contacteditor/frmContactEditor-Save.cpp b/source/contacteditor/frmContactEditor-Save.cpp index 2073e67..9018943 100644 --- a/source/contacteditor/frmContactEditor-Save.cpp +++ b/source/contacteditor/frmContactEditor-Save.cpp @@ -534,23 +534,26 @@ void frmContactEditor::SaveContact( wxCommandEvent& event ) NameData.Title = txtTitle->GetValue(); NameData.Suffix = txtSuffix->GetValue(); - ucd->ContactAccount = wxSContactAccount; - ucd->ContactFilename = FilenameFinal; - ucd->ContactName = cmbDisplayAs->GetValue(); - ucd->ContactNameArray = NameData; + if (this->GetParent() != nullptr) + { + ucd->ContactAccount = wxSContactAccount; + ucd->ContactFilename = FilenameFinal; + ucd->ContactName = cmbDisplayAs->GetValue(); + ucd->ContactNameArray = NameData; - for (std::map::iterator gniter = ContactEditorData.GeneralNicknamesList.begin(); - gniter != ContactEditorData.GeneralNicknamesList.end(); gniter++){ + for (std::map::iterator gniter = ContactEditorData.GeneralNicknamesList.begin(); + gniter != ContactEditorData.GeneralNicknamesList.end(); gniter++){ - ucd->ContactNickname = gniter->second; - break; + ucd->ContactNickname = gniter->second; + break; + } + + wxCommandEvent event2(CE_UPDATECONTACTLIST); + event2.SetClientData(ucd); + wxPostEvent(MainPtr, event2); } - wxCommandEvent event2(CE_UPDATECONTACTLIST); - event2.SetClientData(ucd); - wxPostEvent(MainPtr, event2); - } void frmContactEditor::SaveCloseContact( wxCommandEvent& event ) -- 2.39.5