Check that list is not empty before accessing it