Polyline in Immediate Mode using DrawCommands and submesh-y joins submits draw for non-existent join submeshes

Avatar

I'm submitting a Draw.Line call inside a DrawCommand which is degenerate (has two points which are both the same point). I need to fix my bug. However, when this call is reified in Draw.cs, at lines 113-116 below (the 1 at the end of the `new IMDrawer(...` line is the submesh index):

if( joins.HasJoinMesh() ) {
using( new IMDrawer( mpbPolylineJoins, ShapesMaterialUtils.GetPolylineJoinsMat( joins )[Draw.BlendMode], mesh, 1 ) )
ApplyToMpb( mpbPolylineJoins );
}

with my line, there are no joins, and we get error logs from URP every frame when it tries to draw the mesh.

Proposed fixes:
Add an extra condition to submit this call, either `&& path.Count > 2` or `&& mesh.subMeshCount > 1`

- or-

Emit an second, empty submesh, even when there aren't joins

Could also detect and error on degenerate polylines (maybe only in editor), but I think this might be unnecessary; if the user is submitting bad lines, that's kinda their fault and is also fairly noticeable.

Reporting a bug? please specify Unity version:
6000.0.38f1
Reporting a bug? please specify Shapes version:
4.5.0
Reporting a bug? please specify Render Pipeline:
URP