- lstAccountsIndex = lstAccounts->GetNextItem(lstAccountsIndex,
- wxLIST_NEXT_ALL,
- wxLIST_STATE_SELECTED);
+ // Check if an account has been selected before continuing.
+
+ lstAccountsIndex = lstAccounts->GetNextItem(lstAccountsIndex,
+ wxLIST_NEXT_ALL,
+ wxLIST_STATE_SELECTED);
+
+ if (lstAccountsIndex == -1){
+
+ // No account has been selected so exit this subroutine.
+
+ return;
+
+ }
+
+ wxFileConfig *cfgfile = new wxFileConfig("", "", AccFilename);
+
+ // Check that the account type is a supported account type.
+
+ AccType = preferences->accounts.GetAccountType((int)lstAccountsIndex);
+
+ if (AccType != "CardDAV" && AccType != "carddav" &&
+ AccType != "Local" && AccType != "local"){
+
+ wxMessageBox(_("Cannot modify the selected account settings as the account type is unsupported."), _("Unsupported account type"), wxICON_ERROR);
+ return;
+
+ }
+
+ // Get the account name.