1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-31 07:29:49 +00:00

Fix crash when we change a non-existant texture in a TextureRect

This should never happen, but just in case.
This commit is contained in:
Manolis Papadeas 2022-02-28 20:40:13 +02:00
parent cce9161122
commit 092ddc0a7a

View file

@ -315,6 +315,8 @@ func disable_button(button: BaseButton, disable: bool) -> void:
func change_button_texturerect(texture_button: TextureRect, new_file_name: String) -> void:
if !texture_button.texture:
return
var file_name := texture_button.texture.resource_path.get_basename().get_file()
var directory_path := texture_button.texture.resource_path.get_basename().replace(file_name, "")
texture_button.texture = load(directory_path.plus_file(new_file_name))