Prevent crash in TextureRegionEditor. Fixes #5862
This commit is contained in:
parent
f00e0b589f
commit
6622a3d110
@ -703,14 +703,24 @@ void TextureRegionEditor::_edit_region()
|
|||||||
bool merged = true;
|
bool merged = true;
|
||||||
while (merged) {
|
while (merged) {
|
||||||
merged = false;
|
merged = false;
|
||||||
|
bool queue_erase = false;
|
||||||
for (List<Rect2>::Element *F = autoslice_cache.front(); F; F=F->next()) {
|
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)
|
if (F==E)
|
||||||
continue;
|
continue;
|
||||||
if (E->get().grow(1).intersects(F->get())) {
|
if (E->get().grow(1).intersects(F->get())) {
|
||||||
E->get().expand_to(F->get().pos);
|
E->get().expand_to(F->get().pos);
|
||||||
E->get().expand_to(F->get().pos+F->get().size);
|
E->get().expand_to(F->get().pos+F->get().size);
|
||||||
F=F->prev();
|
if (F->prev()) {
|
||||||
autoslice_cache.erase(F->next());
|
F=F->prev();
|
||||||
|
autoslice_cache.erase(F->next());
|
||||||
|
} else {
|
||||||
|
queue_erase = true;
|
||||||
|
//Cant delete the first rect in the list.
|
||||||
|
}
|
||||||
merged = true;
|
merged = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user