From ff758467dd2995c4404416e062c8c66cc84255dd Mon Sep 17 00:00:00 2001 From: OverloadedOrama <35376950+OverloadedOrama@users.noreply.github.com> Date: Sun, 12 Jan 2020 22:43:07 +0200 Subject: [PATCH] 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. --- Changelog.md | 1 + Scripts/Canvas.gd | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Changelog.md b/Changelog.md index 06fb6aa71..1f7520f54 100644 --- a/Changelog.md +++ b/Changelog.md @@ -29,6 +29,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Fixed bug where, if you had a random brush selected and then selected the pencil tool, "brush color from" did not appear. - Fixed crash on Godot 3.2.beta6 when pressing the Edit Palette button. - The canvas updates automatically when onion skinning settings change. +- 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. ## [v0.6] - 06-01-2020 diff --git a/Scripts/Canvas.gd b/Scripts/Canvas.gd index 1e54f3f1f..e4387eb81 100644 --- a/Scripts/Canvas.gd +++ b/Scripts/Canvas.gd @@ -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"):