From: divverent Date: Sat, 14 Apr 2007 20:44:36 +0000 (+0000) Subject: fix segfault sendcvar for non existing cvars introduced in r6933 X-Git-Tag: xonotic-v0.1.0preview~3335 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=679f31232d927e129a0d37d0325a9e62ff8845ad;p=xonotic%2Fdarkplaces.git fix segfault sendcvar for non existing cvars introduced in r6933 git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7095 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/host_cmd.c b/host_cmd.c index d60489b3..bac0d142 100644 --- a/host_cmd.c +++ b/host_cmd.c @@ -1955,17 +1955,19 @@ void Host_SendCvar_f (void) { int i; cvar_t *c; + const char *cvarname; client_t *old; if(Cmd_Argc() != 2) return; - c = Cvar_FindVar(Cmd_Argv(1)); + cvarname = Cmd_Argv(1); if (cls.state == ca_connected) { + c = Cvar_FindVar(cvarname); // LordHavoc: if there is no such cvar or if it is private, send a // reply indicating that it has no value if(!c || (c->flags & CVAR_PRIVATE)) - Cmd_ForwardStringToServer(va("sentcvar %s\n", c->name)); + Cmd_ForwardStringToServer(va("sentcvar %s\n", cvarname)); else Cmd_ForwardStringToServer(va("sentcvar %s \"%s\"\n", c->name, c->string)); return; @@ -1982,7 +1984,7 @@ void Host_SendCvar_f (void) if(svs.clients[i].active && svs.clients[i].netconnection) { host_client = &svs.clients[i]; - Host_ClientCommands(va("sendcvar %s\n", c->name)); + Host_ClientCommands(va("sendcvar %s\n", cvarname)); } host_client = old; }