瀏覽代碼

RichTextLabel::add_image Fail if passed image has no area

(cherry picked from commit a4afdd4a77f7d169f046416570bf60ab24c79845)
kleonc 4 年之前
父節點
當前提交
e40682c32d
共有 1 個文件被更改,包括 2 次插入0 次删除
  1. 2 0
      scene/gui/rich_text_label.cpp

+ 2 - 0
scene/gui/rich_text_label.cpp

@@ -1678,6 +1678,8 @@ void RichTextLabel::add_image(const Ref<Texture> &p_image, const int p_width, co
 		return;
 
 	ERR_FAIL_COND(p_image.is_null());
+	ERR_FAIL_COND(p_image->get_width() == 0);
+	ERR_FAIL_COND(p_image->get_height() == 0);
 	ItemImage *item = memnew(ItemImage);
 
 	item->image = p_image;