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

Error encoding object typed array with var_to_bytes and decoding with bytes_to_var_with_objects #94384

Closed
Faless opened this issue Jul 15, 2024 · 0 comments · Fixed by #94379
Closed

Comments

@Faless
Copy link
Collaborator

Faless commented Jul 15, 2024

Tested versions

System information

Irrelevant

Issue description

Encoding a (object) typed array with var_to_bytes then decoding with bytes_to_var_with_objects cause an error.

While this is very uncommon, encoding with var_to_bytes and decoding with bytes_to_var_with_objects should always be possible.

Steps to reproduce

Run the following script:

func _ready():
	var res := ImageTexture.new()
	var my_arr : Array[ImageTexture]
	my_arr.push_back(res)
	print(bytes_to_var_with_objects(var_to_bytes(my_arr)))

Notice the error:

ERROR: Attempted to push_back an object of type 'EncodedObjectAsID' into a TypedArray, which does not inherit from 'ImageTexture'.
   at: validate_object (core/variant/container_type_validate.h:129)
ERROR: Condition "!_p->typed.validate(value, "push_back")" is true.
   at: push_back (core/variant/array.cpp:285)

Minimal reproduction project (MRP)

See the script above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Bad
Development

Successfully merging a pull request may close this issue.

1 participant