adds validation for missing image sources on tilesheets

This commit is contained in:
atravita-mods 2023-06-20 22:07:57 -04:00 committed by Jesse Plamondon-Willard
parent 251d83472c
commit 7c6da8e5ec
No known key found for this signature in database
GPG Key ID: CF8B1456B3E29F49
1 changed files with 6 additions and 0 deletions

View File

@ -432,6 +432,12 @@ namespace StardewModdingAPI.Framework.ContentManagers
this.Monitor.VerboseLog($"Fixing tilesheet paths for map '{relativeMapPath}' from mod '{this.ModName}'...");
foreach (TileSheet tilesheet in map.TileSheets)
{
// validate image source
if (string.IsNullOrWhiteSpace(tilesheet.ImageSource))
{
throw new SContentLoadException(ContentLoadErrorType.InvalidData, $"Could not load tilesheet '{tilesheet.Id}' for mod {this.ModName} - no image source found.");
}
// get image source
tilesheet.ImageSource = this.NormalizePathSeparators(tilesheet.ImageSource);
string imageSource = tilesheet.ImageSource;