dimanche 1 janvier 2023

Exception thrown at 0x00007FFF43E0F551 (ucrtbased.dll) [closed]

So I'm trying to make my own game using SDL for the engine and TinyXML for parsing the map. When trying to parse I get a crash which I'm not sure what what is wrong, I just know where it happens and general idea why but I'm not sure how to fix it.

TileSet MapParser::ParseTileset(TiXmlElement* xmlTileset)
{    
    TileSet tileset;       

    //crash    
    tileset.name = xmlTileset->Attribute("name");
    xmlTileset->Attribute("firstgid", &tileset.firstID);
              
    xmlTileset->Attribute("tilecount", &tileset.tileCount);
    tileset.lastID = (tileset.firstID + tileset.tileCount) - 1;
       
    xmlTileset->Attribute("columns", &tileset.colCount);
    tileset.colCount = tileset.tileCount / tileset.colCount;

    xmlTileset->Attribute("tilewidth", &tileset.tileSize);

    TiXmlElement* image = xmlTileset->FirstChildElement();
    tileset.source = image->Attribute("source");
    
    return tileset;
}

I'm trying to assign the name of the XML attribute to the tileset variable that is part of "TileSet" struct

struct TileSet
{
    int firstID, lastID;
    int rowCount, colCount;
    int tileCount, tileSize;
    std::string name, source;
};

It also happens to all assigns to the "TileSet" variables.

Aucun commentaire:

Enregistrer un commentaire