From 311c966f97b7d3c2767ec1f7db1fd16baf27a044 Mon Sep 17 00:00:00 2001 From: Nick Hastings Date: Thu, 18 May 2023 23:18:34 -0400 Subject: [PATCH] Fix late-registered ConCommands not saving handle --- tier1/convar.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tier1/convar.cpp b/tier1/convar.cpp index 5290f124..52bda5a8 100644 --- a/tier1/convar.cpp +++ b/tier1/convar.cpp @@ -52,12 +52,14 @@ public: { if ( s_bConCommandsRegistered ) { - g_pCVar->RegisterConCommand( pCmd, s_nCVarFlag ); - if ( !pCmd->GetRef()->handle.IsValid() ) + ConCommandHandle hndl = g_pCVar->RegisterConCommand( pCmd, s_nCVarFlag ); + if ( !hndl.IsValid() ) { Plat_FatalErrorFunc( "RegisterConCommand: Unknown error registering con command \"%s\"!\n", pCmd->GetName() ); DebuggerBreakIfDebugging(); } + + pCmd->SetHandle( hndl ); } else {