From d87c6bd06a61a4f763cb6c9b1fe7e77f59d692c9 Mon Sep 17 00:00:00 2001 From: Joonas Rikkonen Date: Thu, 22 Feb 2018 11:11:08 +0200 Subject: [PATCH] Fixed exceptions when creating items with a powertransfer component mid-round (e.g. when fabricating a relay component). Closes #267 --- .../Source/Items/Components/Power/PowerTransfer.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Barotrauma/BarotraumaShared/Source/Items/Components/Power/PowerTransfer.cs b/Barotrauma/BarotraumaShared/Source/Items/Components/Power/PowerTransfer.cs index 45370c7b0..fabdbf224 100644 --- a/Barotrauma/BarotraumaShared/Source/Items/Components/Power/PowerTransfer.cs +++ b/Barotrauma/BarotraumaShared/Source/Items/Components/Power/PowerTransfer.cs @@ -174,7 +174,14 @@ namespace Barotrauma.Items.Components var connections = item.Connections; foreach (Connection c in connections) { - if (!connectionDirty[c]) continue; + if (!connectionDirty.ContainsKey(c)) + { + connectionDirty[c] = true; + } + else if (!connectionDirty[c]) + { + continue; + } HashSet connected = new HashSet(); if (!connectedRecipients.ContainsKey(c))