Fix crash when drawing line gizmo with less than 2 vertices (#9101)

# Objective

Fix #9089

## Solution

Don't try to draw lines with less than 2 vertices. These would not be
visible either way.

---------

Co-authored-by: François <mockersf@gmail.com>
This commit is contained in:
ira 2023-08-15 23:50:37 +02:00 committed by Carter Anderson
parent a58fd312b8
commit 657c14026a

View File

@ -470,6 +470,10 @@ impl<P: PhaseItem> RenderCommand<P> for DrawLineGizmo {
return RenderCommandResult::Failure;
};
if line_gizmo.vertex_count < 2 {
return RenderCommandResult::Success;
}
let instances = if line_gizmo.strip {
let item_size = VertexFormat::Float32x3.size();
let buffer_size = line_gizmo.position_buffer.size() - item_size;