minor clean-up. fix potential invalid access in polyline.