Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Avoid stupid segfault on DEBUG when heap is empty.
[simgrid.git] / src / xbt / heap.c
index c795b76..e035a3a 100644 (file)
@@ -123,11 +123,11 @@ void *xbt_heap_pop(xbt_heap_t H)
   int size = H->size;
   void *max;
 
-  XBT_DEBUG("Heap has %d elements before extraction and max elem was %g",xbt_heap_size(H),xbt_heap_maxkey(H));
-
   if (H->count == 0)
     return NULL;
 
+  XBT_DEBUG("Heap has %d elements before extraction and max elem was %g",xbt_heap_size(H),xbt_heap_maxkey(H));
+
   max = CONTENT(H, 0);
 
   items[0] = items[(H->count) - 1];