Check if actions list is empty before getting last element