Fixed memory buffer overflow and read the last value

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
master
sigonasr2 2 years ago
parent c98b50e4d1
commit e6315b1be8
  1. 11
      TMXParser.h

@ -1,9 +1,8 @@
#include <sstream> #include "pixelGameEngine.h"
#include <fstream> #include <strstream>
#include <map>
#include <vector> using namespace olc;
#include <iostream>
struct XMLTag{ struct XMLTag{
std::string tag; std::string tag;
@ -40,7 +39,6 @@ struct XMLTag{
struct LayerTag{ struct LayerTag{
XMLTag tag; XMLTag tag;
public:
std::vector<std::vector<int>> tiles; std::vector<std::vector<int>> tiles;
std::string str() { std::string str() {
std::string displayStr=tag.tag+"\n"+tag.FormatTagData(tag.data); std::string displayStr=tag.tag+"\n"+tag.FormatTagData(tag.data);
@ -132,7 +130,6 @@ class TMXParser{
if (data.empty()) continue; if (data.empty()) continue;
if (accumulator.length()>0) { if (accumulator.length()>0) {
//We're accumulating strings until we find '>'
accumulator+=" "+data; accumulator+=" "+data;
//Check if it ends with '>' //Check if it ends with '>'
if (data[data.length()-1]=='>') { if (data[data.length()-1]=='>') {

Loading…
Cancel
Save