Handle division by 0 in tripDistances