Fixed segfault when using empty strings with CBotString::operator+

dev-ui
adiblol 2012-09-30 16:00:34 +02:00
parent dd8c2d8d92
commit cb634db2ec
1 changed files with 2 additions and 2 deletions

View File

@ -357,9 +357,9 @@ const CBotString& CBotString::operator+(const CBotString& stringSrc)
{
char* p = static_cast<char*>(malloc(m_lg+stringSrc.m_lg+1));
strcpy(p, m_ptr);
if (m_ptr!=NULL) strcpy(p, m_ptr);
char* pp = p + m_lg;
strcpy(pp, stringSrc.m_ptr);
if (stringSrc.m_ptr!=NULL) strcpy(pp, stringSrc.m_ptr);
free(m_ptr);
m_ptr = p;