From ef7d3abefd557922b81ff34af5509d40c8fa7238 Mon Sep 17 00:00:00 2001 From: "zer0.k" <61156310+zer0k-z@users.noreply.github.com> Date: Tue, 20 Dec 2022 22:50:57 +0100 Subject: [PATCH] Add missing null pointer check to protobuf messages (#1883) --- core/MenuStyle_Radio.cpp | 4 ++++ core/smn_hudtext.cpp | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/core/MenuStyle_Radio.cpp b/core/MenuStyle_Radio.cpp index 81a974c1..035219e3 100644 --- a/core/MenuStyle_Radio.cpp +++ b/core/MenuStyle_Radio.cpp @@ -505,6 +505,10 @@ void CRadioMenuPlayer::Radio_Refresh() #if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV // 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); diff --git a/core/smn_hudtext.cpp b/core/smn_hudtext.cpp index a33b87ba..88621d94 100644 --- a/core/smn_hudtext.cpp +++ b/core/smn_hudtext.cpp @@ -325,6 +325,10 @@ void UTIL_SendHudText(int client, const hud_text_parms &textparms, const char *p #if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE || SOURCE_ENGINE == SE_MCV 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();