fix crash when disguising the spy as infantry without stand2

This commit is contained in:
Matthias Mailänder
2015-07-06 10:00:03 +02:00
parent 4acb096416
commit 41b488779a
3 changed files with 22 additions and 6 deletions

View File

@@ -39,7 +39,9 @@ namespace OpenRA.Mods.RA.Traits
if (disguise.AsSprite != intendedSprite)
{
intendedSprite = disguise.AsSprite;
DefaultAnimation.ChangeImage(intendedSprite ?? rs.GetImage(self), info.StandSequences.Random(Game.CosmeticRandom));
var sequence = DefaultAnimation.GetRandomExistingSequence(info.StandSequences, Game.CosmeticRandom);
if (sequence != null)
DefaultAnimation.ChangeImage(intendedSprite ?? rs.GetImage(self), sequence);
rs.UpdatePalette();
}