diff --git a/src/scheduler.c b/src/scheduler.c
index f9e0533b2567e3a1dfc1d46eb262cd729c6768da..6d721f96d899cc76eb9d500ffde7a48423e5fd4f 100644
--- a/src/scheduler.c
+++ b/src/scheduler.c
@@ -693,6 +693,12 @@ struct task *scheduler_addtask(struct scheduler *s, enum task_types type,
                                enum task_subtypes subtype, int flags, int wait,
                                struct cell *ci, struct cell *cj, int tight) {
 
+#ifdef SWIFT_DEBUG_CHECKS
+  if (ci == NULL && cj != NULL)
+    error("Added a task with ci==NULL and cj!=NULL type=%s/%s",
+          taskID_names[type], subtaskID_names[subtype]);
+#endif
+
   /* Get the next free task. */
   const int ind = atomic_inc(&s->tasks_next);
 
@@ -1080,7 +1086,7 @@ void scheduler_start(struct scheduler *s) {
       /* Don't check MPI stuff */
       if (t->type == task_type_send || t->type == task_type_recv) continue;
 
-     if (ci == NULL && cj == NULL) {	
+      if (ci == NULL && cj == NULL) {
 
         if (t->type != task_type_grav_gather_m && t->type != task_type_grav_fft)
           error("Task not associated with cells!");