From 55ae431c02b42349dd1062146a74a7919418e141 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sat, 7 Jul 2018 12:04:41 +0300 Subject: [PATCH] - fixed crash on setting particular CVARs Game crashed when any of gl_brightfog, gl_lightadditivesurfaces, gl_notexturefill CVARs is set with no level loaded There was impossible to reset settings to defaults because of this --- src/g_level.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/g_level.cpp b/src/g_level.cpp index d5a9e9489..5997e489e 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -106,17 +106,17 @@ void G_VerifySkill(); CUSTOM_CVAR(Bool, gl_brightfog, false, CVAR_ARCHIVE | CVAR_NOINITCALL) { - if (level.info->brightfog == -1) level.brightfog = self; + if (level.info == nullptr || level.info->brightfog == -1) level.brightfog = self; } CUSTOM_CVAR(Bool, gl_lightadditivesurfaces, false, CVAR_ARCHIVE | CVAR_NOINITCALL) { - if (level.info->lightadditivesurfaces == -1) level.lightadditivesurfaces = self; + if (level.info == nullptr || level.info->lightadditivesurfaces == -1) level.lightadditivesurfaces = self; } CUSTOM_CVAR(Bool, gl_notexturefill, false, CVAR_NOINITCALL) { - if (level.info->notexturefill == -1) level.notexturefill = self; + if (level.info == nullptr || level.info->notexturefill == -1) level.notexturefill = self; } CUSTOM_CVAR(Int, gl_lightmode, 3, CVAR_ARCHIVE | CVAR_NOINITCALL)