From 755820d8b240925aeb1dd514ad02d47b4cb49ad1 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sat, 15 Sep 2007 02:55:16 +0000 Subject: [PATCH] don't segfault when trying to use the loc command without a map loaded --- qw/source/teamplay.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/qw/source/teamplay.c b/qw/source/teamplay.c index f6505789f..5a57bba85 100644 --- a/qw/source/teamplay.c +++ b/qw/source/teamplay.c @@ -341,12 +341,16 @@ locs_loc (void) const char *desc = NULL; // FIXME: need to check to ensure you are actually in the game and alive. - if (Cmd_Argc () == 1) { + if (Cmd_Argc () == 1 || strcmp (Cmd_Argv (1), "help") == 0) { Con_Printf ("loc [] " ":Modifies location data, add|rename take " "parameter\n"); return; } + if (!cl.worldmodel) { + Con_Printf ("No map loaded. Unable to work with location markers.\n"); + return; + } if (Cmd_Argc () >= 3) desc = Cmd_Args (2); mapname = malloc (sizeof (cl.worldmodel->name));