mirror of https://github.com/godotengine/godot
Prevent errors when Line2D has 0 length
This commit is contained in:
parent
f418603522
commit
842421ea61
|
|
@ -299,6 +299,9 @@ void Line2D::_draw() {
|
||||||
}
|
}
|
||||||
|
|
||||||
lb.build();
|
lb.build();
|
||||||
|
if (lb.indices.is_empty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
RS::get_singleton()->canvas_item_add_triangle_array(
|
RS::get_singleton()->canvas_item_add_triangle_array(
|
||||||
get_canvas_item(),
|
get_canvas_item(),
|
||||||
|
|
|
||||||
|
|
@ -112,6 +112,11 @@ void LineBuilder::build() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Math::is_zero_approx(total_distance)) {
|
||||||
|
// Zero-length line, nothing to build.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (_interpolate_color) {
|
if (_interpolate_color) {
|
||||||
color0 = gradient->get_color(0);
|
color0 = gradient->get_color(0);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue