1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-22 17:49:43 +01:00

Fix undefined behavior when backspacing in script list with 0 scripts

The problem is that it would index out-of-bounds if you did this, but
this UB hasn't caused an exception until my change to refactor
script-related vectors by removing their separate length-trackers.
This commit is contained in:
Misa 2020-04-03 12:23:37 -07:00 committed by Ethan Lee
parent dafadf158a
commit 7b1388f85c

View file

@ -3596,7 +3596,7 @@ void editorinput()
if(!key.keymap[SDLK_BACKSPACE]) ed.deletekeyheld=0;
if(key.keymap[SDLK_BACKSPACE] && ed.deletekeyheld==0)
if(key.keymap[SDLK_BACKSPACE] && ed.deletekeyheld==0 && !ed.hooklist.empty())
{
ed.deletekeyheld=1;
music.playef(2);