mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2025-01-26 18:54:59 +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:
parent
46559bbe0a
commit
a623190b09
1 changed files with 4 additions and 0 deletions
|
@ -577,6 +577,10 @@ void scriptclass::run()
|
||||||
{
|
{
|
||||||
//Ok, actually display the textbox we've initilised now!
|
//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 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);
|
graphics.createtextbox(txt[0], textx, texty, r, g, b);
|
||||||
if ((int) txt.size() > 1)
|
if ((int) txt.size() > 1)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue