-
- long longSelected = -1;
- int intSelectedData = 0;
-
- if (!GetSelectedItem(lboAddresses,
- &longSelected,
- &intSelectedData)){
- return;
- }
-
- if (longSelected == -1){
- return;
- }
-
- frmContactEditorAddress *frameCEAddress = new frmContactEditorAddress ( this );
- frameCEAddress->SetupPointers(&GeneralAddressList,
- &GeneralAddressListTown,
- &GeneralAddressListCounty,
- &GeneralAddressListPostCode,
- &GeneralAddressListCountry,
- &GeneralAddressListLabel,
- &GeneralAddressListLang,
- &GeneralAddressListAltID,
- &GeneralAddressListPID,
- &GeneralAddressListTokens,
- &GeneralAddressListGeo,
- &GeneralAddressListTimezone,
- &GeneralAddressListType,
- &GeneralAddressListMediatype,
- &GeneralAddressListPref,
- lboAddresses,
- intSelectedData);
- frameCEAddress->SetEditorMode(TRUE, CE_GENERAL);
- frameCEAddress->ShowModal();
- delete frameCEAddress;
- frameCEAddress = NULL;
+
+ // Bring up the window for editing an address.
+
+ long longSelected = -1;
+ int intSelectedData = 0;
+
+ if (lboAddresses->GetItemCount() == 0 || !GetSelectedItem(lboAddresses,
+ &longSelected,
+ &intSelectedData)){
+
+ return;
+
+ }
+
+ if (longSelected == -1){
+
+ return;
+
+ }
+
+ frmContactEditorAddress *frameCEAddress = new frmContactEditorAddress ( this );
+ frameCEAddress->SetupPointers(&ContactEditorData.GeneralAddressList,
+ &ContactEditorData.GeneralAddressListTown,
+ &ContactEditorData.GeneralAddressListCounty,
+ &ContactEditorData.GeneralAddressListPostCode,
+ &ContactEditorData.GeneralAddressListCountry,
+ &ContactEditorData.GeneralAddressListLabel,
+ &ContactEditorData.GeneralAddressListLang,
+ &ContactEditorData.GeneralAddressListAltID,
+ &ContactEditorData.GeneralAddressListPID,
+ &ContactEditorData.GeneralAddressListTokens,
+ &ContactEditorData.GeneralAddressListGeo,
+ &ContactEditorData.GeneralAddressListTimezone,
+ &ContactEditorData.GeneralAddressListType,
+ &ContactEditorData.GeneralAddressListMediatype,
+ &ContactEditorData.GeneralAddressListPref,
+ lboAddresses,
+ intSelectedData);
+ frameCEAddress->SetEditorMode(TRUE, CE_GENERAL);
+ frameCEAddress->ShowModal();
+ delete frameCEAddress;
+ frameCEAddress = NULL;