This commit is contained in:
Vaxry 2023-12-31 16:49:27 +01:00
parent eb9cdea176
commit 0d38ce0e9e

View file

@ -92,7 +92,7 @@ void CConfigValue::defaultFrom(SConfigDefaultValue& ref) {
break; break;
} }
case CONFIGDATATYPE_STR: { case CONFIGDATATYPE_STR: {
if (!m_pData) if (m_pData)
free(m_pData); free(m_pData);
std::string str = std::any_cast<std::string>(ref.data); std::string str = std::any_cast<std::string>(ref.data);
m_pData = calloc(1, str.length() + 1); m_pData = calloc(1, str.length() + 1);
@ -131,6 +131,7 @@ void CConfigValue::setFrom(std::any value) {
break; break;
} }
case CONFIGDATATYPE_STR: { case CONFIGDATATYPE_STR: {
if (m_pData)
free(m_pData); free(m_pData);
std::string str = std::any_cast<std::string>(value); std::string str = std::any_cast<std::string>(value);
m_pData = calloc(1, str.length() + 1); m_pData = calloc(1, str.length() + 1);