diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/SMAPI/Constants.cs | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/SMAPI/Constants.cs b/src/SMAPI/Constants.cs index 9e93551c..6fb796de 100644 --- a/src/SMAPI/Constants.cs +++ b/src/SMAPI/Constants.cs @@ -351,9 +351,16 @@ namespace StardewModdingAPI DirectoryInfo folder = null; foreach (string saveName in new[] { rawSaveName, new string(rawSaveName.Where(char.IsLetterOrDigit).ToArray()) }) { - folder = new DirectoryInfo(Path.Combine(Constants.SavesPath, $"{saveName}_{saveID}")); - if (folder.Exists) - return folder; + try + { + folder = new DirectoryInfo(Path.Combine(Constants.SavesPath, $"{saveName}_{saveID}")); + if (folder.Exists) + return folder; + } + catch (ArgumentException) + { + // ignore invalid path + } } // if save doesn't exist yet, return the default one we expect to be created |