Added nullguard check to SaveActiveModsToProfile

This commit is contained in:
Chomp
2025-05-27 17:17:23 +01:00
parent f97b8b6f4f
commit 2902b757e6
@@ -472,7 +472,11 @@ public class GameController(
protected void SaveActiveModsToProfile(SptProfile fullProfile)
{
fullProfile.SptData!.Mods ??= [];
var mods = _applicationContext?.GetLatestValue(ContextVariableType.LOADED_MOD_ASSEMBLIES).GetValue<List<SptMod>>();
var mods = _applicationContext?.GetLatestValue(ContextVariableType.LOADED_MOD_ASSEMBLIES)?.GetValue<List<SptMod>>();
if (mods == null)
{
return;
}
foreach (var mod in mods)
{