From 91be12eed247f71f53048b38e3ac323ee9fb81d0 Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Fri, 19 Jan 2007 12:29:03 +0000 Subject: [PATCH] * small correctness fixes pmo-trunk-r672 --- src/modest-protocol-info.c | 4 ++-- src/modest-tny-account-store.c | 12 ++++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/modest-protocol-info.c b/src/modest-protocol-info.c index 4856897..125c418 100644 --- a/src/modest-protocol-info.c +++ b/src/modest-protocol-info.c @@ -120,9 +120,9 @@ modest_protocol_info_get_protocol_type (ModestProtocol proto) case MODEST_PROTOCOL_AUTH_NONE: case MODEST_PROTOCOL_AUTH_PASSWORD: return MODEST_PROTOCOL_TYPE_AUTH; - + default: - g_return_val_if_reached (MODEST_PROTOCOL_TYPE_UNKNOWN); + return MODEST_PROTOCOL_TYPE_UNKNOWN; } } diff --git a/src/modest-tny-account-store.c b/src/modest-tny-account-store.c index a3d588f..17c549d 100644 --- a/src/modest-tny-account-store.c +++ b/src/modest-tny-account-store.c @@ -312,14 +312,14 @@ tny_account_for_proto (ModestProtocol proto) TnyAccount *tny_account = NULL; type = modest_protocol_info_get_protocol_type (proto); - + if (type == MODEST_PROTOCOL_TYPE_TRANSPORT) tny_account = TNY_ACCOUNT(tny_camel_transport_account_new ()); else if (proto == MODEST_PROTOCOL_STORE_POP) tny_account = TNY_ACCOUNT(tny_camel_pop_store_account_new ()); else if (proto == MODEST_PROTOCOL_STORE_IMAP) tny_account = TNY_ACCOUNT(tny_camel_imap_store_account_new ()); - else + else g_return_val_if_reached (NULL); if (tny_account) @@ -348,6 +348,12 @@ get_tny_account_from_server_account (ModestTnyAccountStore *self, priv = MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE(self); /* proto */ + if (account_data->proto == MODEST_PROTOCOL_UNKNOWN) { + g_printerr ("modest: '%s' does not provide a protocol\n", + account_data->account_name); + return NULL; + } + tny_account = tny_account_for_proto (account_data->proto); if (!tny_account) { g_printerr ("modest: could not create tny account for '%s'\n", @@ -506,8 +512,6 @@ get_tny_account_from_account (ModestTnyAccountStore *self, ModestAccountData *ac server_account = account_data->store_account; else if (type == TNY_ACCOUNT_STORE_TRANSPORT_ACCOUNTS && account_data->transport_account) server_account = account_data->transport_account; - else - g_return_val_if_reached (NULL); if (!server_account) { g_printerr ("modest: no %s account defined for '%s'\n", -- 1.7.9.5