Fix crashing on polyline building