mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-02-07 10:59: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:
parent
cce9161122
commit
092ddc0a7a
|
@ -315,6 +315,8 @@ func disable_button(button: BaseButton, disable: bool) -> void:
|
||||||
|
|
||||||
|
|
||||||
func change_button_texturerect(texture_button: TextureRect, new_file_name: String) -> 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 file_name := texture_button.texture.resource_path.get_basename().get_file()
|
||||||
var directory_path := texture_button.texture.resource_path.get_basename().replace(file_name, "")
|
var directory_path := texture_button.texture.resource_path.get_basename().replace(file_name, "")
|
||||||
texture_button.texture = load(directory_path.plus_file(new_file_name))
|
texture_button.texture = load(directory_path.plus_file(new_file_name))
|
||||||
|
|
Loading…
Reference in a new issue