aboutsummaryrefslogtreecommitdiffstats
path: root/libemail-engine/e-mail-session-utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'libemail-engine/e-mail-session-utils.c')
-rw-r--r--libemail-engine/e-mail-session-utils.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/libemail-engine/e-mail-session-utils.c b/libemail-engine/e-mail-session-utils.c
index 2ac4170a2e..0694ea60a5 100644
--- a/libemail-engine/e-mail-session-utils.c
+++ b/libemail-engine/e-mail-session-utils.c
@@ -410,15 +410,25 @@ mail_session_send_to_thread (GSimpleAsyncResult *simple,
CamelService *service;
gboolean did_connect = FALSE;
- service = camel_session_get_service (
+ service = camel_session_ref_service (
CAMEL_SESSION (session), context->transport_uid);
+ if (service == NULL) {
+ g_simple_async_result_set_error (
+ simple, CAMEL_SERVICE_ERROR,
+ CAMEL_SERVICE_ERROR_URL_INVALID,
+ _("No mail service found with UID '%s'"),
+ context->transport_uid);
+ return;
+ }
+
if (!CAMEL_IS_TRANSPORT (service)) {
- g_simple_async_result_set_error (simple,
- CAMEL_SERVICE_ERROR,
+ g_simple_async_result_set_error (
+ simple, CAMEL_SERVICE_ERROR,
CAMEL_SERVICE_ERROR_URL_INVALID,
- _("Cannot get transport for account '%s'"),
+ _("UID '%s' is not a mail transport"),
context->transport_uid);
+ g_object_unref (service);
return;
}
@@ -431,6 +441,7 @@ mail_session_send_to_thread (GSimpleAsyncResult *simple,
if (error != NULL) {
g_simple_async_result_take_error (simple, error);
+ g_object_unref (service);
return;
}
}
@@ -450,6 +461,8 @@ mail_session_send_to_thread (GSimpleAsyncResult *simple,
service, error == NULL,
cancellable, error ? NULL : &error);
+ g_object_unref (service);
+
if (error != NULL) {
g_simple_async_result_take_error (simple, error);
return;