Fixed a rare crash with straight lines

It was possible that the variable `is_making_line` could be true, even if the line itself has been freed from memory.
This commit is contained in:
OverloadedOrama 2020-01-12 22:43:07 +02:00
parent 582b9baedb
commit ff758467dd
2 changed files with 2 additions and 1 deletions

View file

@ -287,7 +287,7 @@ func _input(event : InputEvent) -> void:
if is_instance_valid(line_2d):
line_2d.queue_free()
if is_making_line:
if is_making_line && is_instance_valid(line_2d):
var point0 : Vector2 = line_2d.points[0]
var angle := stepify(rad2deg(mouse_pos.angle_to_point(point0)), 0.01)
if Input.is_action_pressed("ctrl"):