Skip to content

Commit

Permalink
Fix compatibility whit rg_hint_message (#583)
Browse files Browse the repository at this point in the history
When used reapi native rg_hint_message not work because tries to access to one pointer who not longer exists in CHintMessage::Send
  • Loading branch information
francoromaniello authored Dec 2, 2020
1 parent 8d6bf01 commit c56982a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion regamedll/dlls/hintmessage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

CHintMessage::CHintMessage(const char *hintString, bool isHint, CUtlVector<const char *> *args, float duration)
{
m_hintString = hintString;
m_hintString = CloneString(hintString);
m_duration = duration;
m_isHint = isHint;

Expand All @@ -16,6 +16,12 @@ CHintMessage::CHintMessage(const char *hintString, bool isHint, CUtlVector<const
CHintMessage::~CHintMessage()
{
m_args.PurgeAndDeleteArrays();

if (m_hintString)
{
delete[] m_hintString;
m_hintString = NULL;
}
}

void CHintMessage::Send(CBaseEntity *client)
Expand Down
2 changes: 1 addition & 1 deletion regamedll/dlls/hintmessage.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class CHintMessage
void Send(CBaseEntity *client);

private:
const char *m_hintString;
char *m_hintString;
bool m_isHint;
CUtlVector<char *> m_args;
float m_duration;
Expand Down

0 comments on commit c56982a

Please sign in to comment.