From b39a4d0b3941be82629d94dfd06f1ddc13fb260b Mon Sep 17 00:00:00 2001 From: antirez Date: Thu, 15 Sep 2011 18:23:58 +0200 Subject: [PATCH] fixed a problem in bioOlderJobType() when there are no jobs of the specified type. Now the function returns 0 when this happens. --- src/bio.c | 4 ++++ 1 file changed, 4 insertions(+) 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]);