Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initiating a drag event when nothing is selected causes a crash #823

Open
MewPurPur opened this issue Jul 24, 2024 · 1 comment
Open

Initiating a drag event when nothing is selected causes a crash #823

MewPurPur opened this issue Jul 24, 2024 · 1 comment
Labels

Comments

@MewPurPur
Copy link
Owner

  1. Hold the cursor pressed over an element in the list
  2. Press Esc while still holding, to deselect the element
  3. Drag the cursor around
  4. Crash
@MewPurPur MewPurPur added the bug label Jul 24, 2024
@MarouaneMebarki
Copy link

It happens because of the static function 'filter_descendant_xids' at
res://src/utils/Utils.gd line: 113

the 'new_xids' array is empty
but at line: 113
you are assigning 'last_acepted' to a value don't exist: Out of bound exception

i honestly didn't explore the project code further
but a temporary quick fix :

static func filter_descendant_xids(xids: Array[PackedInt32Array]) -> Array[PackedInt32Array]:
	if xids.is_empty():
		return xids
	var new_xids: Array[PackedInt32Array] = xids.duplicate()
	new_xids.sort_custom(Utils.compare_xids_r)
	# Linear scan to filter out the descendants.
	var last_accepted := new_xids[0]
	var i := 1
	while i < new_xids.size():
		var xid := new_xids[i]
		if Utils.is_xid_parent_or_self(last_accepted, xid):
			new_xids.remove_at(i)
		else:
			last_accepted = new_xids[i]
			i += 1
	return new_xids

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants