Skip to content

Commit c56982a

Browse files
Fix compatibility whit rg_hint_message (#583)
When used reapi native rg_hint_message not work because tries to access to one pointer who not longer exists in CHintMessage::Send
1 parent 8d6bf01 commit c56982a

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

regamedll/dlls/hintmessage.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
CHintMessage::CHintMessage(const char *hintString, bool isHint, CUtlVector<const char *> *args, float duration)
44
{
5-
m_hintString = hintString;
5+
m_hintString = CloneString(hintString);
66
m_duration = duration;
77
m_isHint = isHint;
88

@@ -16,6 +16,12 @@ CHintMessage::CHintMessage(const char *hintString, bool isHint, CUtlVector<const
1616
CHintMessage::~CHintMessage()
1717
{
1818
m_args.PurgeAndDeleteArrays();
19+
20+
if (m_hintString)
21+
{
22+
delete[] m_hintString;
23+
m_hintString = NULL;
24+
}
1925
}
2026

2127
void CHintMessage::Send(CBaseEntity *client)

regamedll/dlls/hintmessage.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class CHintMessage
6565
void Send(CBaseEntity *client);
6666

6767
private:
68-
const char *m_hintString;
68+
char *m_hintString;
6969
bool m_isHint;
7070
CUtlVector<char *> m_args;
7171
float m_duration;

0 commit comments

Comments
 (0)