From d3152f5a6ea0f939f9535fd8024538d95f14b588 Mon Sep 17 00:00:00 2001 From: Sergio Villar Senin Date: Wed, 14 Oct 2009 10:43:57 +0200 Subject: [PATCH] Fixes NB#139637, coverity defects in modest --- src/hildon2/modest-platform.c | 13 +++++-------- src/hildon2/modest-selector-picker.c | 4 ++-- src/modest-ui-actions.c | 2 +- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/hildon2/modest-platform.c b/src/hildon2/modest-platform.c index 0dc579d..7a15417 100644 --- a/src/hildon2/modest-platform.c +++ b/src/hildon2/modest-platform.c @@ -1925,17 +1925,14 @@ on_timeout_check_account_is_online(CheckAccountIdleData* data) { gboolean stop_trying = FALSE; g_return_val_if_fail (data && data->account, FALSE); - - printf ("DEBUG: %s: tny_account_get_connection_status()==%d\n", __FUNCTION__, - tny_account_get_connection_status (data->account)); - + if (data && data->account && /* We want to wait until TNY_CONNECTION_STATUS_INIT has changed to something else, * after which the account is likely to be usable, or never likely to be usable soon: */ (tny_account_get_connection_status (data->account) != TNY_CONNECTION_STATUS_INIT) ) { data->is_online = TRUE; - + stop_trying = TRUE; } else { /* Give up if we have tried too many times: */ @@ -1946,15 +1943,15 @@ on_timeout_check_account_is_online(CheckAccountIdleData* data) ++(data->count_tries); } } - + if (stop_trying) { /* Allow the function that requested this idle callback to continue: */ if (data->loop) g_main_loop_quit (data->loop); - + if (data->account) g_object_unref (data->account); - + return FALSE; /* Don't call this again. */ } else { return TRUE; /* Call this timeout callback again. */ diff --git a/src/hildon2/modest-selector-picker.c b/src/hildon2/modest-selector-picker.c index 54e320c..0f75875 100644 --- a/src/hildon2/modest-selector-picker.c +++ b/src/hildon2/modest-selector-picker.c @@ -193,8 +193,8 @@ modest_selector_picker_set_pair_list (ModestSelectorPicker *self, ModestPairList model = get_model (pairs); selector = create_touch_selector (self, model); - gtk_tree_model_get_iter_first (GTK_TREE_MODEL(model), &iter); - hildon_touch_selector_select_iter (HILDON_TOUCH_SELECTOR (selector), 0, &iter, TRUE); + if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL(model), &iter)) + hildon_touch_selector_select_iter (HILDON_TOUCH_SELECTOR (selector), 0, &iter, TRUE); g_object_unref (model); hildon_picker_button_set_selector (HILDON_PICKER_BUTTON (self), HILDON_TOUCH_SELECTOR (selector)); diff --git a/src/modest-ui-actions.c b/src/modest-ui-actions.c index d70586d..8bde5ca 100644 --- a/src/modest-ui-actions.c +++ b/src/modest-ui-actions.c @@ -3180,7 +3180,7 @@ modest_ui_actions_on_send (GtkWidget *widget, ModestMsgEditWindow *edit_window) } /* Get the currently-active transport account for this modest account: */ - if (strcmp (account_name, MODEST_LOCAL_FOLDERS_ACCOUNT_ID) != 0) { + if (account_name && strcmp (account_name, MODEST_LOCAL_FOLDERS_ACCOUNT_ID) != 0) { transport_account = TNY_TRANSPORT_ACCOUNT(modest_tny_account_store_get_server_account (modest_runtime_get_account_store (), -- 1.7.9.5