- fixed potential crashes in Linux crash reporter

Do not access various global objects at early stage of initialization and late stage of shutdown
This commit is contained in:
alexey.lysiuk 2019-10-11 12:01:36 +03:00
parent 08a66abde9
commit 279b327c6c

View file

@ -102,6 +102,12 @@ static int DoomSpecificInfo (char *buffer, char *end)
#ifdef __VERSION__
p += snprintf (buffer+p, size-p, "Compiler version: %s\n", __VERSION__);
#endif
// If Args is nullptr, then execution is at either
// * early stage of initialization, additional info contains only default values
// * late stage of shutdown, most likely main() was done, and accessing global variables is no longer safe
if (Args)
{
p += snprintf(buffer + p, size - p, "\nCommand line:");
for (i = 0; i < Args->NumArgs(); ++i)
{
@ -135,6 +141,8 @@ static int DoomSpecificInfo (char *buffer, char *end)
p += snprintf(buffer + p, size - p, "\nviewangle = %f", vp.Angles.Yaw.Degrees);
}
}
}
buffer[p++] = '\n';
buffer[p++] = '\0';