From 66b95f64a5d8bad440ecaf7711c77f1a54052665 Mon Sep 17 00:00:00 2001 From: Pavol Marko Date: Tue, 6 Sep 2005 16:31:07 +0000 Subject: [PATCH] Now checks whether there is a non-zero g_engfuncs.pfnQueryClientCvarValue before setting newdll's pfnCvarValue function pointer --- amxmodx/meta_api.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/amxmodx/meta_api.cpp b/amxmodx/meta_api.cpp index cae2135a..8b8957bf 100755 --- a/amxmodx/meta_api.cpp +++ b/amxmodx/meta_api.cpp @@ -1407,7 +1407,11 @@ C_DLLEXPORT int GetNewDLLFunctions(NEW_DLL_FUNCTIONS *pNewFunctionTable, int *in // default metamod does not call this if the gamedll doesn't provide it g_NewDLL_Available = true; - gNewDLLFunctionTable.pfnCvarValue = C_CvarValue; + // If pfnQueryClientCvarValue is not available, the newdllfunctions table will probably + // not have the pfnCvarValue member -> better don't write there to avoid corruption + if (g_engfuncs.pfnQueryClientCvarValue) + gNewDLLFunctionTable.pfnCvarValue = C_CvarValue; + #ifdef FAKEMETA return g_FakeMeta.GetNewDLLFunctions(pNewFunctionTable, interfaceVersion, &gNewDLLFunctionTable); #else