Browse Source

Added a null check to the AnimationController's animations array.

Gareth Fouche 9 years ago
parent
commit
3edf4aeaab
1 changed files with 7 additions and 0 deletions
  1. 7 0
      Source/Atomic/Graphics/AnimationController.cpp

+ 7 - 0
Source/Atomic/Graphics/AnimationController.cpp

@@ -194,6 +194,10 @@ bool AnimationController::Play(const String& name, unsigned char layer, bool loo
     {
     {
         for (unsigned i = 0; i < animationResources_.Size(); i++)
         for (unsigned i = 0; i < animationResources_.Size(); i++)
         {
         {
+            if (animationResources_[i] == NULL)
+                continue;
+
+        
             if (name == animationResources_[i]->GetAnimationName())
             if (name == animationResources_[i]->GetAnimationName())
             {
             {
                 newAnimation = animationResources_[i];
                 newAnimation = animationResources_[i];
@@ -930,6 +934,9 @@ void AnimationController::FindAnimation(const String& name, unsigned& index, Ani
     {
     {
         for (unsigned i = 0; i < animationResources_.Size(); i++)
         for (unsigned i = 0; i < animationResources_.Size(); i++)
         {
         {
+            if (animationResources_[i] == NULL)
+                continue;
+
             if (name == animationResources_[i]->GetAnimationName())
             if (name == animationResources_[i]->GetAnimationName())
             {
             {
                 nameHash = animationResources_[i]->GetName();
                 nameHash = animationResources_[i]->GetName();