--- libaitsched/src/aitsched.c 2012/03/13 10:01:59 1.6 +++ libaitsched/src/aitsched.c 2012/04/26 08:03:27 1.6.2.2 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: aitsched.c,v 1.6 2012/03/13 10:01:59 misho Exp $ +* $Id: aitsched.c,v 1.6.2.2 2012/04/26 08:03:27 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -484,18 +484,19 @@ schedRun(sched_root_task_t * __restrict root, volatile if (root->root_hooks.hook_exec.fetch) { if (killState) { if (root->root_hooks.hook_exec.condition) - while (root->root_hooks.hook_exec.condition(root, (void*) killState)) { + while (root && root->root_hooks.hook_exec.condition(root, (void*) killState)) { if ((task = root->root_hooks.hook_exec.fetch(root, NULL))) schedCall(task); } else - while (!*killState) { + while (!*killState && root) { if ((task = root->root_hooks.hook_exec.fetch(root, NULL))) schedCall(task); } } else - while ((task = root->root_hooks.hook_exec.fetch(root, NULL))) - schedCall(task); + while (root) + if ((task = root->root_hooks.hook_exec.fetch(root, NULL))) + schedCall(task); } return 0;