mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2025-01-10 19:09:45 +01:00
Clean up script header check in editorclass::load()
The previous person who wrote this (a girl named Misa) clearly didn't understand the reason why you couldn't compare line[line.length()-1] directly to a string literal. It's because the former is a char, and the latter is a pointer to a char. Both are ints, so it compiles fine, but it doesn't do what you want it to. Why not just make the latter a char instead of a string literal? Well, because you can, but also I clearly didn't think this through earlier, so that's why I didn't do it in the first place. But this is fixed now.
This commit is contained in:
parent
4728f64e3a
commit
adbae16666
1 changed files with 1 additions and 8 deletions
|
@ -1878,14 +1878,7 @@ bool editorclass::load(std::string& _path)
|
|||
{
|
||||
std::string& line = values[i];
|
||||
|
||||
//Comparing line[line.length()-1] directly to a string literal is UB
|
||||
//Workaround: assign line[line.length()-1] to a string first
|
||||
std::string temp;
|
||||
if(line.length())
|
||||
{
|
||||
temp = line[line.length()-1];
|
||||
}
|
||||
if(temp == ":")
|
||||
if(line.length() && line[line.length() - 1] == ':')
|
||||
{
|
||||
if(headerfound)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue