diff options
| author | Juan Linietsky | 2016-06-14 08:48:34 -0300 |
|---|---|---|
| committer | Rémi Verschelde | 2016-06-25 01:41:56 +0200 |
| commit | d662f5aa63b205cc20f34e2c597ac8a2e1fc0bf3 (patch) | |
| tree | b876eea3edb5277ae2f6fe2e1888815777c628fa /scene/gui/text_edit.cpp | |
| parent | 85c6d1b37d0a0e55cc50860866951c974de62155 (diff) | |
| download | godot-d662f5aa63b205cc20f34e2c597ac8a2e1fc0bf3.tar.gz godot-d662f5aa63b205cc20f34e2c597ac8a2e1fc0bf3.tar.zst godot-d662f5aa63b205cc20f34e2c597ac8a2e1fc0bf3.zip | |
does not fix the bug reported in #4326 and #4818,
but at least make sure it throws and error and does not crash
(cherry picked from commit 333de40180d7d8d6890cceaa1bc3d46efa2b5083)
Diffstat (limited to 'scene/gui/text_edit.cpp')
| -rw-r--r-- | scene/gui/text_edit.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index d1c4374f8..0e8e0d60b 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -3736,12 +3736,16 @@ void TextEdit::undo() { _do_text_op(op, true); current_op.version=op.prev_version; if(undo_stack_pos->get().chain_backward) { - do { + while(true) { + ERR_BREAK(!undo_stack_pos->prev()); undo_stack_pos = undo_stack_pos->prev(); op = undo_stack_pos->get(); _do_text_op(op, true); current_op.version = op.prev_version; - } while(!undo_stack_pos->get().chain_forward); + if (undo_stack_pos->get().chain_forward) { + break; + } + } } cursor_set_line(undo_stack_pos->get().from_line); @@ -3760,12 +3764,16 @@ void TextEdit::redo() { _do_text_op(op, false); current_op.version = op.version; if(undo_stack_pos->get().chain_forward) { - do { + + while(true) { + ERR_BREAK(!undo_stack_pos->next()); undo_stack_pos=undo_stack_pos->next(); op = undo_stack_pos->get(); _do_text_op(op, false); current_op.version = op.version; - } while(!undo_stack_pos->get().chain_backward); + if (undo_stack_pos->get().chain_backward) + break; + } } cursor_set_line(undo_stack_pos->get().to_line); cursor_set_column(undo_stack_pos->get().to_column); |
