瀏覽代碼

Add error for invalid RichTextLabel.install_effect

RedMser 3 年之前
父節點
當前提交
d3a1e82025
共有 1 個文件被更改,包括 4 次插入5 次删除
  1. 4 5
      scene/gui/rich_text_label.cpp

+ 4 - 5
scene/gui/rich_text_label.cpp

@@ -4883,11 +4883,10 @@ void RichTextLabel::install_effect(const Variant effect) {
 	Ref<RichTextEffect> rteffect;
 	rteffect = effect;
 
-	if (rteffect.is_valid()) {
-		custom_effects.push_back(effect);
-		if ((!text.is_empty()) && use_bbcode) {
-			parse_bbcode(text);
-		}
+	ERR_FAIL_COND_MSG(rteffect.is_null(), "Invalid RichTextEffect resource.");
+	custom_effects.push_back(effect);
+	if ((!text.is_empty()) && use_bbcode) {
+		parse_bbcode(text);
 	}
 }