summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/ContentManagers
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-05-26 01:41:49 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-06-10 00:04:24 -0400
commit5ffa260e02fc8a6eae40c1fd798da2a4877262c0 (patch)
tree42204b5d38b895ad3913084f90aa22d140db5e37 /src/SMAPI/Framework/ContentManagers
parentb6a8dcdd46dbc2875b24e0f77049c61a5cf398d9 (diff)
downloadSMAPI-5ffa260e02fc8a6eae40c1fd798da2a4877262c0.tar.gz
SMAPI-5ffa260e02fc8a6eae40c1fd798da2a4877262c0.tar.bz2
SMAPI-5ffa260e02fc8a6eae40c1fd798da2a4877262c0.zip
add validation error when loading XNB file as IRawTextureData
Diffstat (limited to 'src/SMAPI/Framework/ContentManagers')
-rw-r--r--src/SMAPI/Framework/ContentManagers/ModContentManager.cs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/SMAPI/Framework/ContentManagers/ModContentManager.cs b/src/SMAPI/Framework/ContentManagers/ModContentManager.cs
index f0e9b1b9..44c9d8e4 100644
--- a/src/SMAPI/Framework/ContentManagers/ModContentManager.cs
+++ b/src/SMAPI/Framework/ContentManagers/ModContentManager.cs
@@ -258,6 +258,9 @@ namespace StardewModdingAPI.Framework.ContentManagers
/// <param name="assetName">The asset name relative to the loader root directory.</param>
private T LoadXnbFile<T>(IAssetName assetName)
{
+ if (typeof(T) == typeof(IRawTextureData))
+ throw this.GetLoadError(assetName, ContentLoadErrorType.Other, $"can't read XNB file as type {typeof(IRawTextureData)}; that type can only be read from a PNG file.");
+
// the underlying content manager adds a .xnb extension implicitly, so
// we need to strip it here to avoid trying to load a '.xnb.xnb' file.
IAssetName loadName = assetName.Name.EndsWith(".xnb", StringComparison.OrdinalIgnoreCase)