diff --git a/src/vm.c b/src/vm.c
index 6c0d79b0..50fb326d 100644
--- a/src/vm.c
+++ b/src/vm.c
@@ -566,7 +566,7 @@ void vmThreadedIOCompletedJob(aeEventLoop *el, int fd, void *privdata,
     REDIS_NOTUSED(mask);
     REDIS_NOTUSED(privdata);
 
-    if (privdata == NULL) trytoswap = 0; /* check the comments above... */
+    if (privdata != NULL) trytoswap = 0; /* check the comments above... */
 
     /* For every byte we read in the read side of the pipe, there is one
      * I/O job completed to process. */