Crash on image/panel not found and add TryGet functions for searching

This commit is contained in:
Gustas
2022-10-11 13:52:06 +03:00
committed by abcdefg30
parent e743e6dd61
commit c041ea7d39
4 changed files with 38 additions and 31 deletions

View File

@@ -33,14 +33,7 @@ namespace OpenRA.Mods.Common.Widgets
public Func<string> GetTooltipText;
readonly CachedTransform<(string, string), Sprite> getImageCache = new CachedTransform<(string, string), Sprite>(
((string collection, string image) args) =>
{
var sprite = ChromeProvider.GetImage(args.collection, args.image);
if (sprite == null)
throw new ArgumentException($"Sprite {args.collection}/{args.image} was not found.");
return sprite;
});
((string collection, string image) args) => ChromeProvider.GetImage(args.collection, args.image));
public ImageWidget()
{