generated from sigonasr2/CPlusPlusProjectTemplate
Fixed memory buffer overflow and read the last value
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
parent
7d6a461c07
commit
117ca03c96
@ -127,6 +127,7 @@ class TMXParser{
|
|||||||
while (f.good()) {
|
while (f.good()) {
|
||||||
std::string data;
|
std::string data;
|
||||||
f>>data;
|
f>>data;
|
||||||
|
if (data.empty()) continue;
|
||||||
|
|
||||||
if (accumulator.length()>0) {
|
if (accumulator.length()>0) {
|
||||||
//We're accumulating strings until we find '>'
|
//We're accumulating strings until we find '>'
|
||||||
@ -148,6 +149,9 @@ class TMXParser{
|
|||||||
data = data.substr(data.find(",")+1,std::string::npos);
|
data = data.substr(data.find(",")+1,std::string::npos);
|
||||||
rowData.push_back(stoi(datapiece));
|
rowData.push_back(stoi(datapiece));
|
||||||
}
|
}
|
||||||
|
if (data.length()) {
|
||||||
|
rowData.push_back(stoi(data));
|
||||||
|
}
|
||||||
parsedMapInfo.LayerData[parsedMapInfo.LayerData.size()-1].tiles.push_back(rowData);
|
parsedMapInfo.LayerData[parsedMapInfo.LayerData.size()-1].tiles.push_back(rowData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user