1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-31 07:29:49 +00:00

Don't save erased guides in .pxos

This fixes a crash when saving a pxo with guides that have been removed
This commit is contained in:
OverloadedOrama 2020-07-27 20:03:15 +03:00
parent 8cca37e752
commit 8529e93029
2 changed files with 4 additions and 0 deletions

View file

@ -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

View file

@ -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