Skip to content

Commit

Permalink
Fix a bug that game crashed in vgui_TextImage_paint if non-ASCII text…
Browse files Browse the repository at this point in the history
… was painted.
  • Loading branch information
hzqst committed Jan 23, 2024
1 parent 1e5b628 commit 8d8d1a9
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Plugins/CaptionMod/ClientVGUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ class vgui1_Color
public:
vgui1_Color()
{
vftable = g_vftable_Color;
vftable = NULL;
color[0] = 0;
color[1] = 0;
color[2] = 0;
Expand Down Expand Up @@ -336,6 +336,13 @@ class vgui1_TextImage
void **vftable;
char padding[0x20];
char* text;

public:
vgui1_TextImage()
{
vftable = NULL;
text = NULL;
}
};

hook_t *g_phook_vgui_TextImage_paint = NULL;
Expand Down Expand Up @@ -363,7 +370,7 @@ void __fastcall vgui_TextImage_paint(vgui1_TextImage *pthis, int, void *panel)
if (isNonANSI)
{
vgui1_Color color;
memset(&color, 0, sizeof(color));
color.vftable = g_vftable_Color;
pthis2->getColor(&color);

int r, g, b, a;
Expand Down

0 comments on commit 8d8d1a9

Please sign in to comment.