1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-18 09:09:47 +00:00

Fix crash when re-arranging palette swatches while holding Shift

This commit is contained in:
Emmanouil Papadeas 2024-09-11 16:18:19 +03:00
parent a5efb97d58
commit a5a74e99a3

View file

@ -216,7 +216,7 @@ func insert_color(index: int, new_color: Color) -> void:
var c := PaletteColor.new(new_color, index) var c := PaletteColor.new(new_color, index)
# If insert happens on non empty swatch recursively move the original color # If insert happens on non empty swatch recursively move the original color
# and every other color to its right one swatch to right # and every other color to its right one swatch to right
if colors[index] != null: if colors.has(index):
_move_right(index) _move_right(index)
colors[index] = c colors[index] = c
data_changed.emit() data_changed.emit()
@ -231,7 +231,7 @@ func _move_right(index: int) -> void:
colors_max = width * height colors_max = width * height
# If swatch to right to this color is not empty move that color right too # If swatch to right to this color is not empty move that color right too
if colors[index + 1] != null: if colors.has(index + 1):
_move_right(index + 1) _move_right(index + 1)
colors[index + 1] = colors[index] colors[index + 1] = colors[index]