瀏覽代碼

Merge pull request #18464 from sersoong/master-fixstylebox

Fix stylebox crash
Gilles Roudière 7 年之前
父節點
當前提交
deee9f0cb4
共有 1 個文件被更改,包括 5 次插入1 次删除
  1. 5 1
      scene/resources/style_box.cpp

+ 5 - 1
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");