diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2019-05-28 13:49:34 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-28 13:49:34 +0200 |
commit | bf6f41e0b90faa8a234f4270f68c90a9c968b552 (patch) | |
tree | d9408112f5e06cb75f921ea6d9c1c633b6c9434b /scene/resources/material.cpp | |
parent | 6273e4d76dd62fe123d90d81a46848a927678c99 (diff) | |
parent | 427040372443cd675c63495f0fab8c195b21319d (diff) | |
download | redot-engine-bf6f41e0b90faa8a234f4270f68c90a9c968b552.tar.gz |
Merge pull request #26978 from qarmin/fix_recursive_bitmapfont_crash
Fix crash when trying to set as Bitmap Font fallback one of his parent
Diffstat (limited to 'scene/resources/material.cpp')
-rw-r--r-- | scene/resources/material.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp index 2e035bbd1f..ada0ac07a3 100644 --- a/scene/resources/material.cpp +++ b/scene/resources/material.cpp @@ -38,7 +38,12 @@ void Material::set_next_pass(const Ref<Material> &p_pass) { - ERR_FAIL_COND(p_pass == this); + for (Ref<Material> pass_child = p_pass; pass_child != NULL; pass_child = pass_child->get_next_pass()) { + if (pass_child == this) { + ERR_EXPLAIN("Can't set as next_pass one of its parents to prevent crashes due to recursive loop."); + ERR_FAIL_COND(pass_child == this); + } + } if (next_pass == p_pass) return; |