From f96008fc2e9cd454e2f0b32531cbdaaac1566eeb Mon Sep 17 00:00:00 2001 From: Joonas Rikkonen Date: Sun, 9 Jun 2019 17:41:20 +0300 Subject: [PATCH] (7e2b368ce) Add a null check and change the SelectedContentPackages collection readonly. Should fix the null reference mentioned in a comment of #1513, when starting a Dedicated Server. Does not fix the crash, though. --- Barotrauma/BarotraumaServer/Source/GameMain.cs | 3 +-- Barotrauma/BarotraumaShared/Source/GameSettings.cs | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Barotrauma/BarotraumaServer/Source/GameMain.cs b/Barotrauma/BarotraumaServer/Source/GameMain.cs index f97944a3e..4ae2894b6 100644 --- a/Barotrauma/BarotraumaServer/Source/GameMain.cs +++ b/Barotrauma/BarotraumaServer/Source/GameMain.cs @@ -50,10 +50,9 @@ namespace Barotrauma public static HashSet SelectedPackages { - get { return Config.SelectedContentPackages; } + get { return Config?.SelectedContentPackages; } } - private static ContentPackage vanillaContent; public static ContentPackage VanillaContent { diff --git a/Barotrauma/BarotraumaShared/Source/GameSettings.cs b/Barotrauma/BarotraumaShared/Source/GameSettings.cs index 79f5a57c6..ed7c84adb 100644 --- a/Barotrauma/BarotraumaShared/Source/GameSettings.cs +++ b/Barotrauma/BarotraumaShared/Source/GameSettings.cs @@ -219,7 +219,7 @@ namespace Barotrauma set { TextManager.Language = value; } } - public HashSet SelectedContentPackages { get; set; } + public readonly HashSet SelectedContentPackages = new HashSet(); private HashSet selectedContentPackagePaths = new HashSet();