summaryrefslogtreecommitdiff
path: root/scene/resources
diff options
context:
space:
mode:
authorsersoong <sersoong@gmail.com>2018-04-27 17:22:42 +0800
committersersoong <sersoong@gmail.com>2018-04-27 17:30:28 +0800
commit21eac24af1b119f1e29e33b53bdb88a400de16c3 (patch)
tree3dc1e7659460b4801b935367a02e1a82950ed98c /scene/resources
parente5a13e26265179d9d6b477c6d744758521745123 (diff)
Fixed stylebox crash
Diffstat (limited to 'scene/resources')
-rw-r--r--scene/resources/style_box.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/scene/resources/style_box.cpp b/scene/resources/style_box.cpp
index 626fda50df..ad5a0fd9ab 100644
--- a/scene/resources/style_box.cpp
+++ b/scene/resources/style_box.cpp
@@ -106,7 +106,11 @@ void StyleBoxTexture::set_texture(Ref<Texture> p_texture) {
if (texture == p_texture)
return;
texture = p_texture;
- region_rect = Rect2(Point2(), texture->get_size());
+ if (p_texture.is_null()) {
+ region_rect = Rect2(0, 0, 0, 0);
+ } else {
+ region_rect = Rect2(Point2(), texture->get_size());
+ }
emit_signal("texture_changed");
emit_changed();
_change_notify("texture");