don't segfault when trying to use the loc command without a map loaded

This commit is contained in:
Bill Currie 2007-09-15 02:55:16 +00:00 committed by Jeff Teunissen
parent e8cce4f626
commit 755820d8b2

View file

@ -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 <add|delete|rename|move|save|zsave> [<description>] "
":Modifies location data, add|rename take <description> "
"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));