Added check to prevent bug when centerline shrinks to 0 length