diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2016-07-23 09:50:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-23 09:50:12 +0200 |
commit | 5b12b3997b30470a01bdac9cdb0fa70657b29ac5 (patch) | |
tree | d54f97f1dd0baaf663bcedf41e2b65add3df3b38 | |
parent | 71c12b58014e9ccdce14c8256ac23b8ef969c98e (diff) | |
parent | 6622a3d110e50d1666ab46b1c32cd04bafa265ae (diff) |
Merge pull request #5866 from MarianoGnu/master
Prevent crash in TextureRegionEditor. Fixes #5862
-rw-r--r-- | tools/editor/plugins/texture_region_editor_plugin.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/tools/editor/plugins/texture_region_editor_plugin.cpp b/tools/editor/plugins/texture_region_editor_plugin.cpp index 63d8e2e1cf..db888208fb 100644 --- a/tools/editor/plugins/texture_region_editor_plugin.cpp +++ b/tools/editor/plugins/texture_region_editor_plugin.cpp @@ -703,14 +703,24 @@ void TextureRegionEditor::_edit_region() bool merged = true; while (merged) { merged = false; + bool queue_erase = false; for (List<Rect2>::Element *F = autoslice_cache.front(); F; F=F->next()) { + if (queue_erase){ + autoslice_cache.erase(F->prev()); + queue_erase = false; + } if (F==E) continue; if (E->get().grow(1).intersects(F->get())) { E->get().expand_to(F->get().pos); E->get().expand_to(F->get().pos+F->get().size); - F=F->prev(); - autoslice_cache.erase(F->next()); + if (F->prev()) { + F=F->prev(); + autoslice_cache.erase(F->next()); + } else { + queue_erase = true; + //Cant delete the first rect in the list. + } merged = true; } } |