diff --git a/modules/hamsandwich/DataHandler.cpp b/modules/hamsandwich/DataHandler.cpp index 9e286a629f..044dea049e 100644 --- a/modules/hamsandwich/DataHandler.cpp +++ b/modules/hamsandwich/DataHandler.cpp @@ -408,6 +408,7 @@ static cell AMX_NATIVE_CALL SetHamItemInfo(AMX *amx, cell *params) ItemInfo *pItem = reinterpret_cast(params[1]); cell *ptr = MF_GetAmxAddr(amx, params[3]); int iLen; + char *szString; switch (params[2]) { @@ -420,7 +421,8 @@ static cell AMX_NATIVE_CALL SetHamItemInfo(AMX *amx, cell *params) break; case ItemInfo_pszAmmo1: - pItem->pszAmmo1 = MF_GetAmxString(amx, params[3], 0, &iLen); + szString = MF_GetAmxString(amx, params[3], 0, &iLen); + pItem->pszAmmo1 = szString ? STRING(ALLOC_STRING(szString)) : nullptr; return iLen; case ItemInfo_iMaxAmmo1: @@ -428,7 +430,8 @@ static cell AMX_NATIVE_CALL SetHamItemInfo(AMX *amx, cell *params) break; case ItemInfo_pszAmmo2: - pItem->pszAmmo2 = MF_GetAmxString(amx, params[3], 0, &iLen); + szString = MF_GetAmxString(amx, params[3], 0, &iLen); + pItem->pszAmmo2 = szString ? STRING(ALLOC_STRING(szString)) : nullptr; return iLen; case ItemInfo_iMaxAmmo2: @@ -436,7 +439,8 @@ static cell AMX_NATIVE_CALL SetHamItemInfo(AMX *amx, cell *params) break; case ItemInfo_pszName: - pItem->pszName = MF_GetAmxString(amx, params[3], 0, &iLen); + szString = MF_GetAmxString(amx, params[3], 0, &iLen); + pItem->pszName = szString ? STRING(ALLOC_STRING(szString)) : nullptr; return iLen; case ItemInfo_iMaxClip: