Fixed a crash when there are no tasks at all