1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-02-20 12:33:14 +00:00

Fixed crash when removing the first layer

Global.current_layer was being set to -1
This commit is contained in:
OverloadedOrama 2020-03-08 21:25:09 +02:00
parent 0619d0e1ad
commit 321ac978f1

View file

@ -183,7 +183,10 @@ func _on_RemoveLayer_pressed() -> void:
new_layers.remove(Global.current_layer)
Global.undos += 1
Global.undo_redo.create_action("Remove Layer")
Global.undo_redo.add_do_property(Global, "current_layer", Global.current_layer - 1)
if Global.current_layer > 0:
Global.undo_redo.add_do_property(Global, "current_layer", Global.current_layer - 1)
else:
Global.undo_redo.add_do_property(Global, "current_layer", Global.current_layer)
for c in Global.canvases:
var new_canvas_layers : Array = c.layers.duplicate()