sched.c: Add checks for empty lists.