mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-22 17:49:43 +01:00
Fix undefined behavior when activating scripts
It turns out that the line `tstring=tstring[tstring.size()-1];` also appears once in Scripts.cpp. This causes the game to segfault after activating a terminal with an empty line at the end of it. I added a quick `if` around this line, and set `tstring` to an empty string when needed.
This commit is contained in:
parent
19de5ec59d
commit
93ec5783d5
1 changed files with 5 additions and 1 deletions
|
@ -40,7 +40,11 @@ void scriptclass::load(std::string t)
|
||||||
}else if(scriptend==-1){
|
}else if(scriptend==-1){
|
||||||
//Find the end
|
//Find the end
|
||||||
tstring=script.customscript[i];
|
tstring=script.customscript[i];
|
||||||
tstring=tstring[tstring.size()-1];
|
if (tstring.size() > 0) {
|
||||||
|
tstring=tstring[tstring.size()-1];
|
||||||
|
} else {
|
||||||
|
tstring="";
|
||||||
|
}
|
||||||
if(tstring==":"){
|
if(tstring==":"){
|
||||||
scriptend=i;
|
scriptend=i;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue