From aaa76d4d2c0261551a221a35fe72141200374a54 Mon Sep 17 00:00:00 2001
From: Pedro Gonnet <pedro.gonnet@durham.ac.uk>
Date: Wed, 13 Nov 2013 21:27:46 +0000
Subject: [PATCH] fix indexing errror.

---
 src/queue.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/queue.c b/src/queue.c
index 1961b11..ee55f3b 100644
--- a/src/queue.c
+++ b/src/queue.c
@@ -89,9 +89,9 @@ int queue_get ( struct queue *q , struct qsched *s , int insist ) {
     
         /* Fix the heap. */
         w = tasks[ inds[k] ].weight;
-        if ( k > 0 && w > tasks[ inds[k/2] ].weight )
+        if ( k > 0 && w > tasks[ inds[(k-1)/2] ].weight )
             while ( k > 0 ) {
-                j = k / 2;
+                j = (k - 1) / 2;
                 if ( w > tasks[ inds[j] ].weight ) {
                     temp = inds[j];
                     inds[j] = inds[k];
-- 
GitLab