Fix consumption of empty queue throwing exception.