diff options
author | MarianoGNU <marianognu.easyrpg@gmail.com> | 2016-07-22 21:11:12 -0300 |
---|---|---|
committer | MarianoGNU <marianognu.easyrpg@gmail.com> | 2016-07-22 21:11:12 -0300 |
commit | 6622a3d110e50d1666ab46b1c32cd04bafa265ae (patch) | |
tree | d54f97f1dd0baaf663bcedf41e2b65add3df3b38 /tools | |
parent | f00e0b589f94413afd446c63d941ced77fdda539 (diff) |
Prevent crash in TextureRegionEditor. Fixes #5862
Diffstat (limited to 'tools')
-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; } } |