tasks is not empty,but empty() was called

fix the bug:tasks is not empty,but empty() was called.