From: antirez Date: Thu, 15 Sep 2011 16:23:58 +0000 (+0200) Subject: fixed a problem in bioOlderJobType() when there are no jobs of the specified type... X-Git-Url: https://git.saurik.com/redis.git/commitdiff_plain/b39a4d0b3941be82629d94dfd06f1ddc13fb260b fixed a problem in bioOlderJobType() when there are no jobs of the specified type. Now the function returns 0 when this happens. --- diff --git a/src/bio.c b/src/bio.c index 6f2c8a6c..fc4d5669 100644 --- a/src/bio.c +++ b/src/bio.c @@ -188,6 +188,10 @@ time_t bioOlderJobOfType(int type) { pthread_mutex_lock(&bio_mutex[type]); ln = listFirst(bio_jobs[type]); + if (ln == NULL) { + pthread_mutex_unlock(&bio_mutex[type]); + return 0; + } job = ln->value; time = job->time; pthread_mutex_unlock(&bio_mutex[type]);