diff options
author | adiblol <adiblol@hydrogen> | 2012-09-30 16:00:34 +0200 |
---|---|---|
committer | adiblol <adiblol@hydrogen> | 2012-09-30 16:00:34 +0200 |
commit | cb634db2eca3857290fd16f75627a506d6aea32a (patch) | |
tree | 79f5041f9039716ae96b5b16e1b937baecfa4227 | |
parent | dd8c2d8d927eeab82e1d2c4dde5bf546ca443156 (diff) | |
download | colobot-cb634db2eca3857290fd16f75627a506d6aea32a.tar.gz colobot-cb634db2eca3857290fd16f75627a506d6aea32a.tar.bz2 colobot-cb634db2eca3857290fd16f75627a506d6aea32a.zip |
Fixed segfault when using empty strings with CBotString::operator+
-rw-r--r-- | src/CBot/CBotString.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/CBot/CBotString.cpp b/src/CBot/CBotString.cpp index e52cd05..6f48127 100644 --- a/src/CBot/CBotString.cpp +++ b/src/CBot/CBotString.cpp @@ -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; |