I did this because it was failing when ros_packages was empty. I guess this should really be a check on whether the list is empty.