Avoid calling Queue.add() with empty lists

In some cases add() gives an error if adding an empty list of tasks.