Skip to content

Commit

Permalink
Check if the requested game exists
Browse files Browse the repository at this point in the history
  • Loading branch information
Diordany committed May 18, 2024
1 parent e545b81 commit b40b5ba
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Quake/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -2161,6 +2161,7 @@ static void COM_Game_f (void)
{
if (Cmd_Argc() > 1)
{
char newgamedir[MAX_OSPATH];
const char *p = Cmd_Argv(1);
const char *p2 = Cmd_Argv(2);
searchpath_t *search;
Expand Down Expand Up @@ -2189,6 +2190,14 @@ static void COM_Game_f (void)
}
}

q_strlcpy (newgamedir, va("%s/%s", com_basedir, p), sizeof(newgamedir));

if (Sys_FileType(newgamedir) == FS_ENT_NONE)
{
Con_Printf("The game '%s' couldn't be found.\n", p);
return;
}

if (!q_strcasecmp(p, COM_SkipPath(com_gamedir))) //no change
{
if (com_searchpaths->path_id > 1) { //current game not id1
Expand Down

0 comments on commit b40b5ba

Please sign in to comment.