Fixed sub editor crashing when attempting to use illegal characters in the filename. Closes #207
This commit is contained in:
@@ -378,12 +378,15 @@ namespace Barotrauma
|
||||
nameBox.Flash();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (nameBox.Text.Contains("../"))
|
||||
|
||||
foreach (char illegalChar in Path.GetInvalidFileNameChars())
|
||||
{
|
||||
DebugConsole.ThrowError("Illegal symbols in filename (../)");
|
||||
nameBox.Flash();
|
||||
return false;
|
||||
if (nameBox.Text.Contains(illegalChar))
|
||||
{
|
||||
GUI.AddMessage(TextManager.Get("SubNameIllegalCharsWarning").Replace("[illegalchar]", illegalChar.ToString()), Color.Red, 3.0f);
|
||||
nameBox.Flash();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
string savePath = nameBox.Text + ".sub";
|
||||
|
||||
@@ -226,6 +226,7 @@
|
||||
<ShowGaps>Gaps</ShowGaps>
|
||||
<PreviouslyUsedLabel>Previously used</PreviouslyUsedLabel>
|
||||
<SubNameMissingWarning>Name your submarine before saving it.</SubNameMissingWarning>
|
||||
<SubNameIllegalCharsWarning>Illegal symbols in filename ([illegalchar])</SubNameIllegalCharsWarning>
|
||||
<SubSavedNotification>Submarine saved to [filepath].</SubSavedNotification>
|
||||
<SaveSubDialogHeader>Save submarine</SaveSubDialogHeader>
|
||||
<SaveSubDialogName>Name</SaveSubDialogName>
|
||||
|
||||
Reference in New Issue
Block a user