Fix random scheduler when there is no task for an app. Fixes #545

The random.choice() method failed because some apps do not have at least one task. This is now fixed, returning None when there are no tasks.