Add missing null pointer check to protobuf messages (#1883)

(cherry picked from commit ef7d3abefd)
This commit is contained in:
zer0.k 2022-12-20 22:50:57 +01:00 committed by Your Name
parent dd370c3904
commit 24c92c021c
2 changed files with 8 additions and 0 deletions

View File

@ -503,6 +503,10 @@ void CRadioMenuPlayer::Radio_Refresh()
#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE
// TODO: find what happens past 240 on CS:GO
CCSUsrMsg_ShowMenu *msg = (CCSUsrMsg_ShowMenu *)g_UserMsgs.StartProtobufMessage(g_ShowMenuId, players, 1, USERMSG_BLOCKHOOKS);
if (!msg)
{
return;
}
msg->set_bits_valid_slots(display_keys);
msg->set_display_time(time);
msg->set_menu_string(ptr);

View File

@ -320,6 +320,10 @@ void UTIL_SendHudText(int client, const hud_text_parms &textparms, const char *p
#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE
CCSUsrMsg_HudMsg *msg = (CCSUsrMsg_HudMsg *)g_UserMsgs.StartProtobufMessage(g_HudMsgNum, players, 1, 0);
if (!msg)
{
return;
}
msg->set_channel(textparms.channel & 0xFF);
CMsgVector2D *pos = msg->mutable_pos();