Fix crash when saving a map without overriding an existing file

This commit is contained in:
Rampastring 2020-09-12 00:57:57 +03:00
parent 8edb1bb2b6
commit d7ee3cee6d

View File

@ -858,7 +858,8 @@ namespace MobiusEditor
return false;
}
if (new FileInfo(saveFilename).Length > Globals.MaxMapSize)
var fileInfo = new FileInfo(saveFilename);
if (fileInfo.Exists && fileInfo.Length > Globals.MaxMapSize)
{
MessageBox.Show(string.Format("Map file exceeds the maximum size of {0} bytes.", Globals.MaxMapSize), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}