aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-service.c
diff options
context:
space:
mode:
Diffstat (limited to 'camel/camel-service.c')
-rw-r--r--camel/camel-service.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/camel/camel-service.c b/camel/camel-service.c
index ade9a1d5b2..9c32256fe0 100644
--- a/camel/camel-service.c
+++ b/camel/camel-service.c
@@ -260,10 +260,13 @@ camel_service_connect (CamelService *service, CamelException *ex)
service->status = ret ? CAMEL_SERVICE_CONNECTED : CAMEL_SERVICE_DISCONNECTED;
CAMEL_SERVICE_LOCK (service, connect_op_lock);
- if (unreg)
- camel_operation_unregister (service->connect_op);
- camel_operation_unref (service->connect_op);
- service->connect_op = NULL;
+ if (service->connect_op) {
+ if (unreg)
+ camel_operation_unregister (service->connect_op);
+
+ camel_operation_unref (service->connect_op);
+ service->connect_op = NULL;
+ }
CAMEL_SERVICE_UNLOCK (service, connect_op_lock);
CAMEL_SERVICE_UNLOCK (service, connect_lock);