From 5e6215a37ccc36d95f6ade68059373ff08a2672c Mon Sep 17 00:00:00 2001 From: Joonas Rikkonen Date: Tue, 24 Jul 2018 13:21:02 +0300 Subject: [PATCH] Fixed crashing when attempting to generate hulls with the "autohull" command when there are no walls or doors in the sub. --- .../BarotraumaClient/Source/Screens/SubEditorScreen.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Barotrauma/BarotraumaClient/Source/Screens/SubEditorScreen.cs b/Barotrauma/BarotraumaClient/Source/Screens/SubEditorScreen.cs index c5d6d6bff..b1bbb0131 100644 --- a/Barotrauma/BarotraumaClient/Source/Screens/SubEditorScreen.cs +++ b/Barotrauma/BarotraumaClient/Source/Screens/SubEditorScreen.cs @@ -1082,6 +1082,12 @@ namespace Barotrauma } } + if (wallPoints.Count < 4) + { + DebugConsole.ThrowError("Generating hulls for the submarine failed. Not enough wall structures to generate hulls."); + return; + } + min = wallPoints[0]; max = wallPoints[0]; for (int i = 0; i < wallPoints.Count; i++)