diff --git a/addons/sourcemod/scripting/shavit-checkpoints.sp b/addons/sourcemod/scripting/shavit-checkpoints.sp index 53d9c0f3..f253b5b8 100644 --- a/addons/sourcemod/scripting/shavit-checkpoints.sp +++ b/addons/sourcemod/scripting/shavit-checkpoints.sp @@ -2326,7 +2326,15 @@ public void VScript_OnScriptVMInitialized() MRESReturn Detour_Timer_SetCheckpointCustomData(DHookParam params) { - int client = VScript_HScriptToEntity(params.Get(1)); + HSCRIPT clienthandle = params.Get(1); + + if (clienthandle == view_as(0)) + { + // null object passed in probably + return MRES_Supercede; + } + + int client = VScript_HScriptToEntity(clienthandle); if (client < 1 || client > MaxClients || !IsClientInGame(client)) { @@ -2352,7 +2360,15 @@ MRESReturn Detour_Timer_SetCheckpointCustomData(DHookParam params) MRESReturn Detour_Timer_GetCheckpointCustomData(DHookReturn hret, DHookParam params) { - int client = VScript_HScriptToEntity(params.Get(1)); + HSCRIPT clienthandle = params.Get(1); + + if (clienthandle == view_as(0)) + { + // null object passed in probably + return MRES_Supercede; + } + + int client = VScript_HScriptToEntity(clienthandle); if (client < 1 || client > MaxClients || !IsClientInGame(client)) { diff --git a/addons/sourcemod/scripting/shavit-core.sp b/addons/sourcemod/scripting/shavit-core.sp index 92581350..10b256f2 100644 --- a/addons/sourcemod/scripting/shavit-core.sp +++ b/addons/sourcemod/scripting/shavit-core.sp @@ -3929,11 +3929,21 @@ public void VScript_OnScriptVMInitialized() MRESReturn Detour_Timer_GetTime(DHookReturn hret, DHookParam params) { - int client = VScript_HScriptToEntity(params.Get(1)); + HSCRIPT clienthandle = params.Get(1); + + if (clienthandle == view_as(0)) + { + // null object passed in probably + hret.Value = 0.0; + return MRES_Supercede; + } + + int client = VScript_HScriptToEntity(clienthandle); if (client < 1 || client > MaxClients || !IsClientInGame(client)) { // Log error or something... + hret.Value = 0.0; return MRES_Supercede; } @@ -3944,11 +3954,21 @@ MRESReturn Detour_Timer_GetTime(DHookReturn hret, DHookParam params) MRESReturn Detour_Timer_GetStatus(DHookReturn hret, DHookParam params) { - int client = VScript_HScriptToEntity(params.Get(1)); + HSCRIPT clienthandle = params.Get(1); + + if (clienthandle == view_as(0)) + { + // null object passed in probably + hret.Value = 0; + return MRES_Supercede; + } + + int client = VScript_HScriptToEntity(clienthandle); if (client < 1 || client > MaxClients || !IsClientInGame(client)) { // Log error or something... + hret.Value = 0; return MRES_Supercede; }