Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
LarryRoddenberry opened this issue Jul 24, 2017 · 0 comments

Comments

@LarryRoddenberry
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant