Repository: godot
Issue: Crash in animation bezier editor when moving keys
Labels: bug,topic:editor,confirmed,crash

<!-- Please search existing issues for potential duplicates before filing yours:
https://github.com/godotengine/godot/issues?q=is%3Aissue
-->

3.2.alpha latest master with a few patches of my own.
<!-- Specify commit hash if non-official. -->


Ubuntu 18.04
<!-- Specify GPU model and drivers if graphics-related. -->


Crash with backtrace when moving keys. The terminal shows the following:


```
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_remove_key_at_position: Condition ' idx < 0 ' is true.
   At: scene/resources/animation.cpp:888.
ERROR: track_get_key_time: Index p_key_idx=63 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1278.
ERROR: track_get_key_time: Index p_key_idx=62 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1278.
ERROR: track_get_key_time: Index p_key_idx=61 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1278.
ERROR: track_get_key_time: Index p_key_idx=60 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1278.
ERROR: track_get_key_time: Index p_key_idx=59 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1278.
ERROR: track_get_key_time: Index p_key_idx=58 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1278.
ERROR: track_get_key_time: Index p_key_idx=57 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1278.
ERROR: track_get_key_time: Index p_key_idx=56 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1278.
ERROR: track_get_key_time: Index p_key_idx=55 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1278.
ERROR: track_get_key_time: Index p_key_idx=54 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1278.
ERROR: track_get_key_time: Index p_key_idx=53 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1278.
ERROR: track_get_key_time: Index p_key_idx=52 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1278.
ERROR: track_get_key_time: Index p_key_idx=51 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1278.
ERROR: track_get_key_time: Index p_key_idx=50 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1278.
ERROR: track_get_key_time: Index p_key_idx=49 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1278.
ERROR: track_get_key_time: Index p_key_idx=48 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1278.
ERROR: track_get_key_time: Index p_key_idx=47 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1278.
ERROR: track_get_key_time: Index p_key_idx=46 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1278.
ERROR: track_get_key_time: Index p_key_idx=45 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1278.
ERROR: track_get_key_time: Index p_key_idx=44 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1278.
ERROR: track_get_key_time: Index p_key_idx=43 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1278.
ERROR: track_get_key_time: Index p_key_idx=42 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1278.
ERROR: track_get_key_time: Index p_key_idx=41 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1278.
ERROR: track_get_key_time: Index p_key_idx=40 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1278.
ERROR: track_get_key_time: Index p_key_idx=39 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1278.
ERROR: track_get_key_time: Index p_key_idx=38 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1278.
ERROR: track_get_key_time: Index p_key_idx=37 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1278.
ERROR: track_get_key_time: Index p_key_idx=36 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1278.
ERROR: track_get_key_time: Index p_key_idx=35 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1278.
ERROR: track_get_key_time: Index p_key_idx=34 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1278.
ERROR: track_get_key_time: Index p_key_idx=33 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1278.
ERROR: track_get_key_time: Index p_key_idx=32 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1278.
ERROR: track_get_key_time: Index p_key_idx=31 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1278.
ERROR: track_get_key_time: Index p_key_idx=30 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1278.
ERROR: track_get_key_time: Index p_key_idx=29 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1278.
ERROR: track_get_key_time: Index p_key_idx=28 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1278.
ERROR: track_get_key_time: Index p_key_idx=27 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1278.
ERROR: track_get_key_time: Index p_key_idx=26 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1278.
ERROR: track_get_key_time: Index p_key_idx=25 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1278.
ERROR: track_get_key_time: Index p_key_idx=24 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1278.
ERROR: track_get_key_time: Index p_key_idx=23 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1278.
ERROR: track_get_key_time: Index p_key_idx=22 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1278.
ERROR: track_get_key_time: Index p_key_idx=21 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1278.
ERROR: track_get_key_time: Index p_key_idx=20 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1278.
ERROR: track_get_key_time: Index p_key_idx=19 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1278.
ERROR: track_get_key_time: Index p_key_idx=18 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1278.
ERROR: track_get_key_time: Index p_key_idx=17 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1278.
ERROR: track_get_key_time: Index p_key_idx=16 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1278.
ERROR: track_get_key_time: Index p_key_idx=15 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1278.
ERROR: track_get_key_time: Index p_key_idx=14 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1278.
ERROR: track_get_key_time: Index p_key_idx=13 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1278.
ERROR: track_get_key_time: Index p_key_idx=12 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1278.
ERROR: track_get_key_time: Index p_key_idx=11 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1278.
ERROR: track_get_key_time: Index p_key_idx=10 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1278.
ERROR: track_get_key_time: Index p_key_idx=9 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1278.
ERROR: track_get_key_time: Index p_key_idx=8 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1278.
ERROR: track_get_key_time: Index p_key_idx=7 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1278.
ERROR: track_get_key_time: Index p_key_idx=6 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1278.
ERROR: track_get_key_time: Index p_key_idx=5 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1278.
ERROR: track_get_key_time: Index p_key_idx=4 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1278.
ERROR: track_get_key_time: Index p_key_idx=63 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1278.
ERROR: track_get_key_value: Index p_key_idx=63 out of size (bt->values.size()=4)
   At: scene/resources/animation.cpp:1211.
ERROR: operator[]: FATAL: Index p_index=0 out of size (((Vector<T> *)(this))->_cowdata.size()=0)
   At: ./core/vector.h:49.
handle_crash: Program crashed with signal 4
Dumping the backtrace. Please include this when reporting the bug on https://github.com/godotengine/godot/issues
[1] /lib/x86_64-linux-gnu/libc.so.6(+0x3ef20) [0x7feb2e2c7f20] (??:0)
[2] VectorWriteProxy<Variant>::operator[](int) (/home/puthre/godot/mygodot/godot/./core/vector.h:49 (discriminator 7))
[3] Array::operator[](int) (/home/puthre/godot/mygodot/godot/core/array.cpp:76)
[4] AnimationBezierTrackEdit::_gui_input(Ref<InputEvent> const&) (/home/puthre/godot/mygodot/godot/editor/animation_bezier_editor.cpp:905)
[5] MethodBind1<Ref<InputEvent> const&>::call(Object*, Variant const**, int, Variant::CallError&) (/home/puthre/godot/mygodot/godot/./core/method_bind.gen.inc:775 (discriminator 12))
[6] Object::call_multilevel(StringName const&, Variant const**, int) (/home/puthre/godot/mygodot/godot/core/object.cpp:763 (discriminator 1))
[7] Object::call_multilevel(StringName const&, Variant const&, Variant const&, Variant const&, Variant const&, Variant const&) (/home/puthre/godot/mygodot/godot/core/object.cpp:864)
[8] Viewport::_gui_call_input(Control*, Ref<InputEvent> const&) (/home/puthre/godot/mygodot/godot/scene/main/viewport.cpp:1520 (discriminator 2))
[9] Viewport::_gui_input_event(Ref<InputEvent>) (/home/puthre/godot/mygodot/godot/scene/main/viewport.cpp:1894 (discriminator 3))
[10] Viewport::input(Ref<InputEvent> const&) (/home/puthre/godot/mygodot/godot/scene/main/viewport.cpp:2668 (discriminator 2))
[11] Viewport::_vp_input(Ref<InputEvent> const&) (/home/puthre/godot/mygodot/godot/scene/main/viewport.cpp:1297)
[12] MethodBind1<Ref<InputEvent> const&>::call(Object*, Variant const**, int, Variant::CallError&) (/home/puthre/godot/mygodot/godot/./core/method_bind.gen.inc:775 (discriminator 12))
[13] Object::call(StringName const&, Variant const**, int, Variant::CallError&) (/home/puthre/godot/mygodot/godot/core/object.cpp:921 (discriminator 1))
[14] Object::call(StringName const&, Variant const&, Variant const&, Variant const&, Variant const&, Variant const&) (/home/puthre/godot/mygodot/godot/core/object.cpp:848)
[15] SceneTree::call_group_flags(unsigned int, StringName const&, StringName const&, Variant const&, Variant const&, Variant const&, Variant const&, Variant const&) (/home/puthre/godot/mygodot/godot/scene/main/scene_tree.cpp:264)
[16] SceneTree::input_event(Ref<InputEvent> const&) (/home/puthre/godot/mygodot/godot/scene/main/scene_tree.cpp:419 (discriminator 6))
[17] InputDefault::_parse_input_event_impl(Ref<InputEvent> const&, bool) (/home/puthre/godot/mygodot/godot/main/input_default.cpp:416)
[18] InputDefault::parse_input_event(Ref<InputEvent> const&) (/home/puthre/godot/mygodot/godot/main/input_default.cpp:260)
[19] InputDefault::flush_accumulated_events() (/home/puthre/godot/mygodot/godot/main/input_default.cpp:679)
[20] OS_X11::process_xevents() (/home/puthre/godot/mygodot/godot/platform/x11/os_x11.cpp:2619)
[21] OS_X11::run() (/home/puthre/godot/mygodot/godot/platform/x11/os_x11.cpp:3182)
[22] /home/puthre/godot/mygodot/godot/bin/godot.x11.tools.64(main+0x128) [0x13c054f] (/home/puthre/godot/mygodot/godot/platform/x11/godot_x11.cpp:57)
[23] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7) [0x7feb2e2aab97] (??:0)
[24] /home/puthre/godot/mygodot/godot/bin/godot.x11.tools.64(_start+0x2a) [0x13c036a] (??:?)
-- END OF BACKTRACE --

```