summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2018-05-11 12:18:46 -0400
committerJesse Plamondon-Willard <github@jplamondonw.com>2018-05-11 12:18:46 -0400
commit69850cb1143110877ad0eea206a6537fe42c9063 (patch)
treeba2c4ce79061cafa36eacdb2bb15b48896efdbe4 /src/SMAPI/Framework
parenta996aa12013366f565781067325a196411adb606 (diff)
downloadSMAPI-69850cb1143110877ad0eea206a6537fe42c9063.tar.gz
SMAPI-69850cb1143110877ad0eea206a6537fe42c9063.tar.bz2
SMAPI-69850cb1143110877ad0eea206a6537fe42c9063.zip
fix error when game looks up dialogue for a pet/horse with special characters in their name (#505)
Diffstat (limited to 'src/SMAPI/Framework')
-rw-r--r--src/SMAPI/Framework/SContentManager.cs8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/SMAPI/Framework/SContentManager.cs b/src/SMAPI/Framework/SContentManager.cs
index 9353ee29..e97e655d 100644
--- a/src/SMAPI/Framework/SContentManager.cs
+++ b/src/SMAPI/Framework/SContentManager.cs
@@ -218,14 +218,16 @@ namespace StardewModdingAPI.Framework
/// <summary>Assert that the given key has a valid format.</summary>
/// <param name="key">The asset key to check.</param>
- /// <exception cref="ArgumentException">The asset key is empty or contains invalid characters.</exception>
+ /// <exception cref="SContentLoadException">The asset key is empty or contains invalid characters.</exception>
[SuppressMessage("ReSharper", "ParameterOnlyUsedForPreconditionCheck.Local", Justification = "Parameter is only used for assertion checks by design.")]
public void AssertValidAssetKeyFormat(string key)
{
+ // NOTE: the game checks for ContentLoadException to handle invalid keys, so avoid
+ // throwing other types like ArgumentException here.
if (string.IsNullOrWhiteSpace(key))
- throw new ArgumentException("The asset key or local path is empty.");
+ throw new SContentLoadException("The asset key or local path is empty.");
if (key.Intersect(Path.GetInvalidPathChars()).Any())
- throw new ArgumentException("The asset key or local path contains invalid characters.");
+ throw new SContentLoadException("The asset key or local path contains invalid characters.");
}
/// <summary>Convert an absolute file path into an appropriate asset name.</summary>