Skip to content

Commit

Permalink
sourcetv: try to fix a crash
Browse files Browse the repository at this point in the history
  • Loading branch information
RaphaelIT7 committed Nov 19, 2024
1 parent a859cdb commit 3d8bf66
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2230,7 +2230,10 @@ Returns `IPhysicsEnvironment [NULL]` if invalid.
Else it returns `IPhysicsEnvironment`.

#### bool IPhysicsEnvironment:TransferObject(IPhysicsObject obj, IPhysicsEnvironment newEnvironment)
Transfers the physics object from this environment to the new environment.
Transfers the physics object from this environment to the new environment. #

> [!WARNING]
> You shouldn't transfer players or vehicles.
#### IPhysicsEnvironment:SetGravity(Vector newGravity)
Sets the new gravity in `source_unit/s^2`
Expand Down
8 changes: 7 additions & 1 deletion source/modules/sourcetv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,13 @@ static void hook_CSteam3Server_NotifyClientDisconnect(void* pServer, IClient* pC
{
VPROF_BUDGET("HolyLib - CSteam3Server::NotifyClientDisconnect", VPROF_BUDGETGROUP_HOLYLIB);

if (pClient->GetServer()->IsHLTV())
if (!hltv)
{
detour_CSteam3Server_NotifyClientDisconnect.GetTrampoline<Symbols::CSteam3Server_NotifyClientDisconnect>()(pServer, pClient);
return;
}

if (pClient == hltv->Client(pClient->GetPlayerSlot())) // pClient->GetServer()->IsHLTV() crashes... Why.
{
if (Lua::PushHook("HolyLib:OnSourceTVClientDisconnect"))
{
Expand Down

0 comments on commit 3d8bf66

Please sign in to comment.