Skip to content

TinyXml2 Version 5.0.1 minor change request for functions GetErrorStr1 & GetErrorStr2 #17

@LarryRoddenberry

Description

@LarryRoddenberry

The functions GetErrorStr1 and GetErrorStr2 call GetStr() on a member variable that is a StrPair. If this member variable last operation had been a reset (which is the case most of the time) then call GetStr() will cause the code to throw an assertion. This throw will cause most applications to crash since there is no code to catch that exception. I would suggest the follow changes to those two routines:

const char* XMLDocument::GetErrorStr1() const
{
if (_errorStr1.Empty())
{
return NULL;
}

return _errorStr1.GetStr();

}

const char* XMLDocument::GetErrorStr2() const
{
if (_errorStr2.Empty())
{
return NULL;
}

return _errorStr2.GetStr();

}

This is a simple addition of an "if statement" to check to see if the StrPair is empty and if so return a NULL;

Thanks
Larry

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions