From d84a2bd5ca55eef3336966bca949ea9ea0422e3e Mon Sep 17 00:00:00 2001
From: Matthieu Schaller <matthieu.schaller@durham.ac.uk>
Date: Sun, 21 Aug 2016 13:39:35 +0100
Subject: [PATCH] Only add the extra tasks to the scheduler mask if they exist.
 Better be safe than sorry.

---
 src/engine.c | 8 +++++---
 src/runner.c | 3 +--
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/engine.c b/src/engine.c
index 90c9b650ec..7c62114730 100644
--- a/src/engine.c
+++ b/src/engine.c
@@ -2723,12 +2723,14 @@ void engine_step(struct engine *e) {
     mask |= 1 << task_type_sub_self;
     mask |= 1 << task_type_sub_pair;
     mask |= 1 << task_type_ghost;
-    mask |= 1 << task_type_extra_ghost; /* Adding unnecessary things to the mask
-                                                  does not harm */
 
     submask |= 1 << task_subtype_density;
-    submask |= 1 << task_subtype_gradient;
     submask |= 1 << task_subtype_force;
+
+#ifdef EXTRA_HYDRO_LOOP
+    mask |= 1 << task_type_extra_ghost;
+    submask |= 1 << task_subtype_gradient;
+#endif
   }
 
   /* Add the tasks corresponding to self-gravity to the masks */
diff --git a/src/runner.c b/src/runner.c
index b2c7c5cd2f..b21d27403a 100644
--- a/src/runner.c
+++ b/src/runner.c
@@ -1136,8 +1136,7 @@ void *runner_main(void *data) {
       /* Different types of tasks... */
       switch (t->type) {
         case task_type_self:
-          if (t->subtype == task_subtype_density) 
-	    runner_doself1_density(r, ci);
+          if (t->subtype == task_subtype_density) runner_doself1_density(r, ci);
 #ifdef EXTRA_HYDRO_LOOP
           else if (t->subtype == task_subtype_gradient)
             runner_doself1_gradient(r, ci);
-- 
GitLab