mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Common: fix crash when GetMaterialAtCrossHair() returns NULL
We checked on the wrong far, materialGlue->Get() returns the static instance within the class, and since its always offset with 16 bytes, the address would be 0x10 if materialGlue is nullptr so the check would always be satisfied. Check on materialGlue itself now and only get the static instance if its available.
This commit is contained in:
parent
2083bc73fa
commit
2dc28bb742
@ -305,10 +305,11 @@ static void PrintChildMat(const CMaterialGlue* const materialGlue, const char* c
|
||||
void Mat_CrossHair_f(const CCommand& args)
|
||||
{
|
||||
const CMaterialGlue* const materialGlue = v_GetMaterialAtCrossHair();
|
||||
const MaterialGlue_s* const material = materialGlue->Get();
|
||||
|
||||
if (material)
|
||||
if (materialGlue)
|
||||
{
|
||||
const MaterialGlue_s* const material = materialGlue->Get();
|
||||
|
||||
Msg(eDLL_T::MS, "______________________________________________________________\n");
|
||||
Msg(eDLL_T::MS, "-+ Material --------------------------------------------------\n");
|
||||
Msg(eDLL_T::MS, " |-- Address: '%llX'\n", material);
|
||||
|
Loading…
x
Reference in New Issue
Block a user