diff --git a/lib/smtp.c b/lib/smtp.c
index 5938c3ff430b40d9c49ef9a74887c2d465ba0f90..da760172408128eb6b44c5d425988dc49f557dfb 100644
--- a/lib/smtp.c
+++ b/lib/smtp.c
@@ -1642,7 +1642,7 @@ static CURLcode smtp_done(struct connectdata *conn, CURLcode status,
 
   (void)premature;
 
-  if(!smtp)
+  if(!smtp || !pp->conn)
     /* When the easy handle is removed from the multi interface while libcurl
        is still trying to resolve the host name, the SMTP struct is not yet
        initialized. However, the removal action calls Curl_done() which in