diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp index 2661b667383..67a9d2a9ed3 100644 --- a/scene/resources/font.cpp +++ b/scene/resources/font.cpp @@ -486,6 +486,7 @@ Size2 Font::get_string_size(const String &p_string) const { } void BitmapFont::set_fallback(const Ref &p_fallback) { + ERR_FAIL_COND(p_fallback == this); fallback = p_fallback; } diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp index 2977eefb069..ba9e5a0af3d 100644 --- a/scene/resources/texture.cpp +++ b/scene/resources/texture.cpp @@ -836,6 +836,7 @@ uint32_t AtlasTexture::get_flags() const { void AtlasTexture::set_atlas(const Ref &p_atlas) { + ERR_FAIL_COND(p_atlas == this); if (atlas == p_atlas) return; atlas = p_atlas; @@ -1074,6 +1075,7 @@ void LargeTexture::set_piece_offset(int p_idx, const Point2 &p_offset) { void LargeTexture::set_piece_texture(int p_idx, const Ref &p_texture) { + ERR_FAIL_COND(p_texture == this); ERR_FAIL_INDEX(p_idx, pieces.size()); pieces[p_idx].texture = p_texture; }; @@ -1619,6 +1621,7 @@ void ProxyTexture::_bind_methods() { void ProxyTexture::set_base(const Ref &p_texture) { + ERR_FAIL_COND(p_texture == this); base = p_texture; if (base.is_valid()) { VS::get_singleton()->texture_set_proxy(proxy, base->get_rid());