Menu

#128 TiXmlString& operator=(const char *) exceptions on NULL

open
nobody
None
5
2012-03-21
2012-03-21
Sean
No

TiXmlString's '=' operator (char*) will crash on NULL values. For example:

TiXmlString str;
str = NULL;

Since TiXmlString has its own 'null' representation, shouldn't this use that in this case? I.E.:

TiXmlString& operator = (const char * copy)
{
if(copy == NULL) // handle null string cases
{
clear();
return *this;
}

return assign( copy, (size_type)strlen(copy));
}

Discussion

  • Sean

    Sean - 2012-03-21

    The two "TIXML_EXPLICIT TiXmlString (const char *)" ctors would also need this handling if this is indeed invalid behavior.

     
  • M Sharath

    M Sharath - 2012-07-23

    i am a new software developer .. i would like to work on this bug, so please assign it to me

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.