mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 23:02:03 +00:00
- fixed undefined behavior with iterating over null unique_ptrs.
I have no idea why this works most of the time - it should crash right away.
This commit is contained in:
parent
706157d623
commit
7916b16efc
8 changed files with 30 additions and 23 deletions
|
@ -1960,7 +1960,7 @@ int loaddefinitions_game(const char *fileName, int32_t firstPass)
|
|||
if (pScript)
|
||||
parsedefinitions_game(pScript, firstPass);
|
||||
|
||||
for (auto & m : *userConfig.AddDefs)
|
||||
if (userConfig.AddDefs) for (auto & m : *userConfig.AddDefs)
|
||||
parsedefinitions_game_include(m, NULL, "null", firstPass);
|
||||
|
||||
if (pScript)
|
||||
|
|
|
@ -3409,7 +3409,7 @@ int32_t loaddefinitionsfile(const char *fn)
|
|||
defsparser(script);
|
||||
}
|
||||
|
||||
for (auto& m : *userConfig.AddDefs)
|
||||
if (userConfig.AddDefs) for (auto& m : *userConfig.AddDefs)
|
||||
defsparser_include(m, NULL, NULL);
|
||||
|
||||
g_logFlushWindow = f;
|
||||
|
|
|
@ -455,6 +455,10 @@ int RunGame()
|
|||
addArt.Push(art);
|
||||
}
|
||||
}
|
||||
if (userConfig.AddArt) for (auto& art : *userConfig.AddArt)
|
||||
{
|
||||
addArt.Push(art);
|
||||
}
|
||||
TileFiles.AddArt(addArt);
|
||||
|
||||
CONFIG_InitMouseAndController();
|
||||
|
|
|
@ -327,7 +327,7 @@ void InitFileSystem(TArray<GrpEntry>& groups)
|
|||
{
|
||||
// Build's original 'file system' loads all GRPs before the first external directory.
|
||||
// Do this only if explicitly requested because this severely limits the usability of GRP files.
|
||||
if (insertdirectoriesafter) for (auto& file : *userConfig.AddFilesPre)
|
||||
if (insertdirectoriesafter && userConfig.AddFilesPre) for (auto& file : *userConfig.AddFilesPre)
|
||||
{
|
||||
D_AddFile(Files, '*' + file); // The * tells the file system not to pull in all subdirectories.
|
||||
}
|
||||
|
@ -337,27 +337,30 @@ void InitFileSystem(TArray<GrpEntry>& groups)
|
|||
i--;
|
||||
}
|
||||
|
||||
if (!insertdirectoriesafter) for (auto& file : *userConfig.AddFilesPre)
|
||||
if (!insertdirectoriesafter && userConfig.AddFilesPre) for (auto& file : *userConfig.AddFilesPre)
|
||||
{
|
||||
D_AddFile(Files, file);
|
||||
}
|
||||
for (auto& file : *userConfig.AddFiles)
|
||||
if (userConfig.AddFiles)
|
||||
{
|
||||
D_AddFile(Files, file);
|
||||
}
|
||||
|
||||
// Finally, if the last entry in the chain is a directory, it's being considered the mod directory, and all GRPs inside need to be loaded, too.
|
||||
if (userConfig.AddFiles->NumArgs() > 0)
|
||||
{
|
||||
auto fn = (*userConfig.AddFiles)[userConfig.AddFiles->NumArgs() - 1];
|
||||
bool isdir = false;
|
||||
if (DirEntryExists(fn, &isdir) && isdir)
|
||||
for (auto& file : *userConfig.AddFiles)
|
||||
{
|
||||
// Insert the GRPs before this entry itself.
|
||||
FString lastfn;
|
||||
Files.Pop(lastfn);
|
||||
D_AddDirectory(Files, fn);
|
||||
Files.Push(lastfn);
|
||||
D_AddFile(Files, file);
|
||||
}
|
||||
|
||||
// Finally, if the last entry in the chain is a directory, it's being considered the mod directory, and all GRPs inside need to be loaded, too.
|
||||
if (userConfig.AddFiles->NumArgs() > 0)
|
||||
{
|
||||
auto fn = (*userConfig.AddFiles)[userConfig.AddFiles->NumArgs() - 1];
|
||||
bool isdir = false;
|
||||
if (DirEntryExists(fn, &isdir) && isdir)
|
||||
{
|
||||
// Insert the GRPs before this entry itself.
|
||||
FString lastfn;
|
||||
Files.Pop(lastfn);
|
||||
D_AddDirectory(Files, fn);
|
||||
Files.Push(lastfn);
|
||||
}
|
||||
}
|
||||
}
|
||||
const char* key;
|
||||
|
|
|
@ -5325,7 +5325,7 @@ int loaddefinitions_game(const char *fileName, int32_t firstPass)
|
|||
if (pScript)
|
||||
parsedefinitions_game(pScript, firstPass);
|
||||
|
||||
for (auto& m : *userConfig.AddDefs)
|
||||
if (userConfig.AddDefs) for (auto& m : *userConfig.AddDefs)
|
||||
parsedefinitions_game_include(m, NULL, "null", firstPass);
|
||||
|
||||
if (pScript)
|
||||
|
|
|
@ -5937,7 +5937,7 @@ void C_Compile(const char *fileName)
|
|||
C_AddDefaultDefinitions();
|
||||
C_ParseCommand(true);
|
||||
|
||||
for (FString& m : *userConfig.AddCons.get())
|
||||
if (userConfig.AddCons) for (FString& m : *userConfig.AddCons.get())
|
||||
{
|
||||
C_Include(m);
|
||||
}
|
||||
|
|
|
@ -6741,7 +6741,7 @@ int loaddefinitions_game(const char *fileName, int32_t firstPass)
|
|||
if (pScript)
|
||||
parsedefinitions_game(pScript, firstPass);
|
||||
|
||||
for (auto& m : *userConfig.AddDefs)
|
||||
if (userConfig.AddDefs) for (auto& m : *userConfig.AddDefs)
|
||||
parsedefinitions_game_include(m, NULL, "null", firstPass);
|
||||
|
||||
if (pScript)
|
||||
|
|
|
@ -2244,7 +2244,7 @@ void C_Compile(const char *fileName)
|
|||
|
||||
C_ParseCommand(1);
|
||||
|
||||
for (FString & m : *userConfig.AddCons.get())
|
||||
if (userConfig.AddCons) for (FString & m : *userConfig.AddCons.get())
|
||||
{
|
||||
C_Include(m);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue