1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2025-01-10 19:09:45 +01:00

Fix using speak/speak_active without a text beforehand

Otherwise, it would end up indexing a vector out-of-bounds, which is UB
and causes a segfault, too. This is used in some constructs like

    say(-1)
    <internal command>

where the text contents don't matter, only that a text box shows up.
This commit is contained in:
Misa 2020-05-23 12:47:56 -07:00 committed by Ethan Lee
parent 46559bbe0a
commit a623190b09

View file

@ -577,6 +577,10 @@ void scriptclass::run()
{
//Ok, actually display the textbox we've initilised now!
//If using "speak", don't make the textbox active (so we can use multiple textboxes)
if (txt.empty())
{
txt.resize(1);
}
graphics.createtextbox(txt[0], textx, texty, r, g, b);
if ((int) txt.size() > 1)
{