From 8b6da6b03335b1ddd950dc887f5e3152c76db031 Mon Sep 17 00:00:00 2001 From: NotAlwaysTrue <77662224+NotAlwaysTrue@users.noreply.github.com> Date: Thu, 30 Apr 2026 22:35:30 +0800 Subject: [PATCH] Added a null check for STW Changed positions of notes --- .../BarotraumaShared/SharedSource/Map/MapEntity.cs | 10 +++++----- .../SharedSource/SingleThreadWorker.cs | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Barotrauma/BarotraumaShared/SharedSource/Map/MapEntity.cs b/Barotrauma/BarotraumaShared/SharedSource/Map/MapEntity.cs index a5066076b..21cec0761 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Map/MapEntity.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Map/MapEntity.cs @@ -656,6 +656,11 @@ namespace Barotrauma List gapList = Gap.GapList.ToList(); // This should never break again... right? + + //update gaps in random order, because otherwise in rooms with multiple gaps + //the water/air will always tend to flow through the first gap in the list, + //which may lead to weird behavior like water draining down only through + //one gap in a room even if there are several int n = gapList.Count; while (n > 1) { @@ -685,11 +690,6 @@ namespace Barotrauma }); }, () => - //update gaps in random order, because otherwise in rooms with multiple gaps - //the water/air will always tend to flow through the first gap in the list, - //which may lead to weird behavior like water draining down only through - //one gap in a room even if there are several - // moved waterflow reset here to see if we can reduce at least some time { // PLEASE WORK diff --git a/Barotrauma/BarotraumaShared/SharedSource/SingleThreadWorker.cs b/Barotrauma/BarotraumaShared/SharedSource/SingleThreadWorker.cs index c16530aa8..d83ca9769 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/SingleThreadWorker.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/SingleThreadWorker.cs @@ -87,7 +87,7 @@ namespace Barotrauma { try { - action.Invoke(); + action?.Invoke(); } catch (Exception e) {