Fixes NB#139637, coverity defects in modest
authorSergio Villar Senin <svillar@igalia.com>
Wed, 14 Oct 2009 08:43:57 +0000 (10:43 +0200)
committerSergio Villar Senin <svillar@igalia.com>
Wed, 14 Oct 2009 08:43:57 +0000 (10:43 +0200)
src/hildon2/modest-platform.c
src/hildon2/modest-selector-picker.c
src/modest-ui-actions.c

index 0dc579d..7a15417 100644 (file)
@@ -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);
 {
        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;
        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: */
                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);
                }
        }
                        ++(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 (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);
                if (data->account)
                        g_object_unref (data->account);
-               
+
                return FALSE; /* Don't call this again. */
        } else {
                return TRUE; /* Call this timeout callback again. */
                return FALSE; /* Don't call this again. */
        } else {
                return TRUE; /* Call this timeout callback again. */
index 54e320c..0f75875 100644 (file)
@@ -193,8 +193,8 @@ modest_selector_picker_set_pair_list (ModestSelectorPicker *self, ModestPairList
        model = get_model (pairs);
 
        selector = create_touch_selector (self, model);
        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));
        g_object_unref (model);
 
        hildon_picker_button_set_selector (HILDON_PICKER_BUTTON (self), HILDON_TOUCH_SELECTOR (selector));
index d70586d..8bde5ca 100644 (file)
@@ -3180,7 +3180,7 @@ modest_ui_actions_on_send (GtkWidget *widget, ModestMsgEditWindow *edit_window)
        }
 
        /* Get the currently-active transport account for this modest account: */
        }
 
        /* 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 (),
                transport_account =
                        TNY_TRANSPORT_ACCOUNT(modest_tny_account_store_get_server_account
                                              (modest_runtime_get_account_store (),