Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
frmContactEditor: Check for parent window before sending update event
authorSteve Brokenshire <sbrokenshire@xestia.co.uk>
Fri, 12 Jan 2018 00:10:08 +0000 (00:10 +0000)
committerSteve Brokenshire <sbrokenshire@xestia.co.uk>
Fri, 12 Jan 2018 00:10:08 +0000 (00:10 +0000)
source/contacteditor/frmContactEditor-Save.cpp

index 2073e67..9018943 100644 (file)
@@ -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<int,wxString>::iterator gniter = ContactEditorData.GeneralNicknamesList.begin();
-               gniter != ContactEditorData.GeneralNicknamesList.end(); gniter++){
+               for (std::map<int,wxString>::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 )
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy