Fix NullPointerException when running a task with no particles