From 12eee1d28522dbd0aea72fcd460432905725c815 Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Fri, 1 Feb 2008 20:16:56 +0000 Subject: [PATCH] * in some weird cases, the msg-id and/or the 'item' might be NULL. handle that case (fixes a crash, NB#80177) pmo-trunk-r4131 --- src/modest-tny-send-queue.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/modest-tny-send-queue.c b/src/modest-tny-send-queue.c index 9db9a6f..db4a1af 100644 --- a/src/modest-tny-send-queue.c +++ b/src/modest-tny-send-queue.c @@ -514,12 +514,8 @@ modest_tny_send_queue_get_msg_id (TnyHeader *header) static void -_on_msg_start_sending (TnySendQueue *self, - TnyHeader *header, - TnyMsg *msg, - int done, - int total, - gpointer user_data) +_on_msg_start_sending (TnySendQueue *self, TnyHeader *header, + TnyMsg *msg, int done, int total, gpointer user_data) { ModestTnySendQueuePrivate *priv = NULL; GList *item = NULL; @@ -530,16 +526,20 @@ _on_msg_start_sending (TnySendQueue *self, /* Get message uid */ msg_id = modest_tny_send_queue_get_msg_id (header); - - /* Get status info */ - item = modest_tny_send_queue_lookup_info (MODEST_TNY_SEND_QUEUE (self), msg_id); - - /* Set current status item */ - info = item->data; - info->status = MODEST_TNY_SEND_QUEUE_SENDING; - g_signal_emit (self, signals[STATUS_CHANGED_SIGNAL], 0, info->msg_id, info->status); - priv->current = item; - + if (msg_id) + item = modest_tny_send_queue_lookup_info (MODEST_TNY_SEND_QUEUE (self), msg_id); + else + g_warning ("%s: could not get msg-id for header", __FUNCTION__); + + if (item) { + /* Set current status item */ + info = item->data; + info->status = MODEST_TNY_SEND_QUEUE_SENDING; + g_signal_emit (self, signals[STATUS_CHANGED_SIGNAL], 0, info->msg_id, info->status); + priv->current = item; + } else + g_warning ("%s: could not find item with id '%s'", __FUNCTION__, msg_id); + /* free */ g_free (msg_id); } -- 1.7.9.5