Skip to content

Commit e913764

Browse files
authored
Fixed out of bounds error by rebind/connect the pressed signal with the correct index. (#349)
1 parent 0353294 commit e913764

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

lorien/UI/Dialogs/EditPaletteDialog.gd

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,15 @@ func _on_RemoveColorButton_pressed() -> void:
122122
arr.append(c)
123123
index += 1
124124
_palette.colors = PackedColorArray(arr)
125-
126-
_color_grid.remove_child(_active_button)
125+
126+
_color_grid.remove_child(_active_button)
127+
128+
var buttonIndex : int = 0
129+
for button : PaletteButton in _color_grid.get_children():
130+
button.pressed.disconnect(_on_platte_button_pressed)
131+
button.pressed.connect(_on_platte_button_pressed.bind(button, buttonIndex))
132+
buttonIndex += 1
133+
127134
_active_button_index = min(_active_button_index, _color_grid.get_child_count() - 1)
128135
_active_button = _color_grid.get_child(_active_button_index)
129136
_on_platte_button_pressed(_active_button, _color_grid.get_child_count() - 1)

0 commit comments

Comments
 (0)