Explorar o código

Added null checks for add/set animation.

closes #173
NathanSweet %!s(int64=10) %!d(string=hai) anos
pai
achega
8dc8f8f9e8
Modificáronse 1 ficheiros con 2 adicións e 0 borrados
  1. 2 0
      spine-csharp/src/AnimationState.cs

+ 2 - 0
spine-csharp/src/AnimationState.cs

@@ -191,6 +191,7 @@ namespace Spine {
 
 
 		/// <summary>Set the current animation. Any queued animations are cleared.</summary>
 		/// <summary>Set the current animation. Any queued animations are cleared.</summary>
 		public TrackEntry SetAnimation (int trackIndex, Animation animation, bool loop) {
 		public TrackEntry SetAnimation (int trackIndex, Animation animation, bool loop) {
+			if (animationName == null) throw new ArgumentException("animation cannot be null.");
 			TrackEntry entry = new TrackEntry();
 			TrackEntry entry = new TrackEntry();
 			entry.animation = animation;
 			entry.animation = animation;
 			entry.loop = loop;
 			entry.loop = loop;
@@ -209,6 +210,7 @@ namespace Spine {
 		/// <summary>Adds an animation to be played delay seconds after the current or last queued animation.</summary>
 		/// <summary>Adds an animation to be played delay seconds after the current or last queued animation.</summary>
 		/// <param name="delay">May be <= 0 to use duration of previous animation minus any mix duration plus the negative delay.</param>
 		/// <param name="delay">May be <= 0 to use duration of previous animation minus any mix duration plus the negative delay.</param>
 		public TrackEntry AddAnimation (int trackIndex, Animation animation, bool loop, float delay) {
 		public TrackEntry AddAnimation (int trackIndex, Animation animation, bool loop, float delay) {
+			if (animationName == null) throw new ArgumentException("animation cannot be null.");
 			TrackEntry entry = new TrackEntry();
 			TrackEntry entry = new TrackEntry();
 			entry.animation = animation;
 			entry.animation = animation;
 			entry.loop = loop;
 			entry.loop = loop;