Skip to content

Commit 4b87801

Browse files
committed
optimize vanilla asset load when the asset doesn't exist
1 parent a0beb10 commit 4b87801

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/SMAPI/Framework/ContentCoordinator.cs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -575,14 +575,19 @@ private bool TryLoadVanillaAsset<T>(string assetName, [NotNullWhen(true)] out T?
575575
{
576576
try
577577
{
578-
asset = this.VanillaContentManager.Load<T>(assetName);
579-
return true;
578+
if (this.VanillaContentManager.DoesAssetExist<T>(assetName))
579+
{
580+
asset = this.VanillaContentManager.Load<T>(assetName);
581+
return true;
582+
}
580583
}
581584
catch
582585
{
583-
asset = default;
584-
return false;
586+
// handled below
585587
}
588+
589+
asset = default;
590+
return false;
586591
}
587592

588593
/// <summary>Get the language enums (like <see cref="LocalizedContentManager.LanguageCode.ja"/>) indexed by locale code (like <c>ja-JP</c>).</summary>

0 commit comments

Comments
 (0)