Break potential infinite loop in msProjectSegment (#4961)