Browse Source

Remove unnecessary validity checks from `Button` and `TextureRect`

The one in `TextureRect` appears to be a leftover from earlier code, and
the one in `Button` was copied from there.
A Thousand Ships 1 year ago
parent
commit
380db4d03e
2 changed files with 4 additions and 8 deletions
  1. 2 4
      scene/gui/button.cpp
  2. 2 4
      scene/gui/texture_rect.cpp

+ 2 - 4
scene/gui/button.cpp

@@ -554,10 +554,8 @@ void Button::set_icon(const Ref<Texture2D> &p_icon) {
 }
 }
 
 
 void Button::_texture_changed() {
 void Button::_texture_changed() {
-	if (icon.is_valid()) {
-		queue_redraw();
-		update_minimum_size();
-	}
+	queue_redraw();
+	update_minimum_size();
 }
 }
 
 
 Ref<Texture2D> Button::get_icon() const {
 Ref<Texture2D> Button::get_icon() const {

+ 2 - 4
scene/gui/texture_rect.cpp

@@ -189,10 +189,8 @@ bool TextureRect::_set(const StringName &p_name, const Variant &p_value) {
 #endif
 #endif
 
 
 void TextureRect::_texture_changed() {
 void TextureRect::_texture_changed() {
-	if (texture.is_valid()) {
-		queue_redraw();
-		update_minimum_size();
-	}
+	queue_redraw();
+	update_minimum_size();
 }
 }
 
 
 void TextureRect::set_texture(const Ref<Texture2D> &p_tex) {
 void TextureRect::set_texture(const Ref<Texture2D> &p_tex) {