diff --git a/Barotrauma/BarotraumaShared/Source/Map/Submarine.cs b/Barotrauma/BarotraumaShared/Source/Map/Submarine.cs index 66456de83..89d3155f7 100644 --- a/Barotrauma/BarotraumaShared/Source/Map/Submarine.cs +++ b/Barotrauma/BarotraumaShared/Source/Map/Submarine.cs @@ -323,7 +323,7 @@ namespace Barotrauma for (int i = 0; i <= maxLoadRetries; i++) { doc = OpenFile(filePath); - if (doc != null || i == maxLoadRetries) { break; } + if (doc != null || i == maxLoadRetries || !File.Exists(filePath)) { break; } DebugConsole.NewMessage("Opening submarine file \"" + filePath + "\" failed, retrying in 250 ms..."); Thread.Sleep(250); } @@ -1192,7 +1192,7 @@ namespace Barotrauma for (int i = 0; i <= maxLoadRetries; i++) { doc = OpenFile(filePath); - if (doc != null || i == maxLoadRetries) { break; } + if (doc != null || i == maxLoadRetries || !File.Exists(filePath)) { break; } DebugConsole.NewMessage("Loading the submarine \"" + Name + "\" failed, retrying in 250 ms..."); Thread.Sleep(250); } diff --git a/Barotrauma/BarotraumaShared/Source/Utils/SaveUtil.cs b/Barotrauma/BarotraumaShared/Source/Utils/SaveUtil.cs index 601318392..3fbf744cc 100644 --- a/Barotrauma/BarotraumaShared/Source/Utils/SaveUtil.cs +++ b/Barotrauma/BarotraumaShared/Source/Utils/SaveUtil.cs @@ -169,7 +169,7 @@ namespace Barotrauma if (!Directory.Exists(folder)) { - DebugConsole.Log("Save folder \"" + folder + " not found! Attempting to create a new folder"); + DebugConsole.Log("Save folder \"" + folder + " not found! Attempting to create a new folder..."); try { Directory.CreateDirectory(folder); @@ -358,8 +358,8 @@ namespace Barotrauma } catch (IOException e) { - if (i >= maxRetries) { throw; } - DebugConsole.NewMessage("Failed to initiate a file transfer {" + e.Message + "}, retrying in 250 ms...", Color.Red); + if (i >= maxRetries || !File.Exists(sCompressedFile)) { throw; } + DebugConsole.NewMessage("Failed decompress file \"" + sCompressedFile + "\" {" + e.Message + "}, retrying in 250 ms...", Color.Red); Thread.Sleep(250); } }