From 8529e93029339228873db12573b7f24aa88f24c8 Mon Sep 17 00:00:00 2001 From: OverloadedOrama <35376950+OverloadedOrama@users.noreply.github.com> Date: Mon, 27 Jul 2020 20:03:15 +0300 Subject: [PATCH] Don't save erased guides in .pxos This fixes a crash when saving a pxo with guides that have been removed --- src/Classes/Project.gd | 2 ++ src/UI/Rulers/Guide.gd | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/Classes/Project.gd b/src/Classes/Project.gd index f6dd75a07..c3696ad95 100644 --- a/src/Classes/Project.gd +++ b/src/Classes/Project.gd @@ -204,6 +204,8 @@ func serialize() -> Dictionary: for guide in guides: if guide is SymmetryGuide: continue + if !is_instance_valid(guide): + continue var coords = guide.points[0].x if guide.type == Guide.Types.HORIZONTAL: coords = guide.points[0].y diff --git a/src/UI/Rulers/Guide.gd b/src/UI/Rulers/Guide.gd index e2f57d49d..1d0794a6b 100644 --- a/src/UI/Rulers/Guide.gd +++ b/src/UI/Rulers/Guide.gd @@ -63,10 +63,12 @@ func _draw() -> void: func outside_canvas() -> bool: if type == Types.HORIZONTAL: if points[0].y < 0 || points[0].y > project.size.y: + project.guides.erase(self) queue_free() return true else: if points[0].x < 0 || points[0].x > project.size.x: + project.guides.erase(self) queue_free() return true return false