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