Check for NULL pointers. CID 1589 and 1590.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38107 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini 2010-08-15 09:42:53 +00:00
parent 756ea297c2
commit 0f72bf29fe

View File

@ -154,55 +154,55 @@ AutoConfigWindow::QuitRequested(void)
Account* Account*
AutoConfigWindow::GenerateBasicAccount() AutoConfigWindow::GenerateBasicAccount()
{ {
if(!fAccount){ if(!fAccount) {
fAccount = Accounts::NewAccount(); fAccount = Accounts::NewAccount();
fAccount->SetType(fAccountInfo.type); fAccount->SetType(fAccountInfo.type);
fAccount->SetName(fAccountInfo.accountName.String()); fAccount->SetName(fAccountInfo.accountName.String());
fAccount->SetRealName(fAccountInfo.name.String()); fAccount->SetRealName(fAccountInfo.name.String());
fAccount->SetReturnAddress(fAccountInfo.email.String()); fAccount->SetReturnAddress(fAccountInfo.email.String());
BMailChain *inbound = fAccount->Inbound();
BString inServerName; BString inServerName;
int32 authType = 0; int32 authType = 0;
int32 ssl = 0; int32 ssl = 0;
if (fAccountInfo.inboundType == IMAP) { if (fAccountInfo.inboundType == IMAP) {
inServerName = fAccountInfo.providerInfo.imap_server; inServerName = fAccountInfo.providerInfo.imap_server;
ssl = fAccountInfo.providerInfo.ssl_imap; ssl = fAccountInfo.providerInfo.ssl_imap;
} } else {
else {
inServerName = fAccountInfo.providerInfo.pop_server; inServerName = fAccountInfo.providerInfo.pop_server;
authType = fAccountInfo.providerInfo.authentification_pop; authType = fAccountInfo.providerInfo.authentification_pop;
ssl = fAccountInfo.providerInfo.ssl_pop; ssl = fAccountInfo.providerInfo.ssl_pop;
} }
if (fAccountInfo.type == INBOUND_TYPE if (fAccountInfo.type == INBOUND_TYPE
|| fAccountInfo.type == IN_AND_OUTBOUND_TYPE) || fAccountInfo.type == IN_AND_OUTBOUND_TYPE) {
{ BMailChain *inbound = fAccount->Inbound();
BMessage inboundArchive; if (inbound != NULL) {
inboundArchive.AddString("server", inServerName); BMessage inboundArchive;
inboundArchive.AddInt32("auth_method", authType); inboundArchive.AddString("server", inServerName);
inboundArchive.AddInt32("flavor", ssl); inboundArchive.AddInt32("auth_method", authType);
inboundArchive.AddString("username", fAccountInfo.loginName); inboundArchive.AddInt32("flavor", ssl);
inboundArchive.AddString("password", fAccountInfo.password); inboundArchive.AddString("username", fAccountInfo.loginName);
inboundArchive.AddBool("leave_mail_on_server", true); inboundArchive.AddString("password", fAccountInfo.password);
inboundArchive.AddBool("delete_remote_when_local", true); inboundArchive.AddBool("leave_mail_on_server", true);
inbound->SetFilter(0, inboundArchive, fAccountInfo.inboundProtocol); inboundArchive.AddBool("delete_remote_when_local", true);
inbound->SetFilter(0, inboundArchive, fAccountInfo.inboundProtocol);
}
} }
if (fAccountInfo.type == OUTBOUND_TYPE if (fAccountInfo.type == OUTBOUND_TYPE
|| fAccountInfo.type == IN_AND_OUTBOUND_TYPE) || fAccountInfo.type == IN_AND_OUTBOUND_TYPE) {
{
BMailChain *outbound = fAccount->Outbound(); BMailChain *outbound = fAccount->Outbound();
BMessage outboundArchive; if (outbound != NULL) {
outboundArchive.AddString("server", BMessage outboundArchive;
fAccountInfo.providerInfo.smtp_server); outboundArchive.AddString("server",
outboundArchive.AddString("username", fAccountInfo.loginName); fAccountInfo.providerInfo.smtp_server);
outboundArchive.AddString("password", fAccountInfo.password); outboundArchive.AddString("username", fAccountInfo.loginName);
outboundArchive.AddInt32("auth_method", outboundArchive.AddString("password", fAccountInfo.password);
fAccountInfo.providerInfo.authentification_smtp); outboundArchive.AddInt32("auth_method",
outboundArchive.AddInt32("flavor", fAccountInfo.providerInfo.ssl_smtp); fAccountInfo.providerInfo.authentification_smtp);
outbound->SetFilter(1, outboundArchive, outboundArchive.AddInt32("flavor", fAccountInfo.providerInfo.ssl_smtp);
fAccountInfo.outboundProtocol); outbound->SetFilter(1, outboundArchive,
fAccountInfo.outboundProtocol);
}
} }
} }
return fAccount; return fAccount;