瀏覽代碼

Merge pull request #974 from ChrisWiki/master

Fixes a bug in createChannel if keyCount=1
Sean Paul Taylor 12 年之前
父節點
當前提交
9d33dc635d
共有 1 個文件被更改,包括 5 次插入3 次删除
  1. 5 3
      gameplay/src/Animation.cpp

+ 5 - 3
gameplay/src/Animation.cpp

@@ -341,9 +341,11 @@ Animation::Channel* Animation::createChannel(AnimationTarget* target, int proper
         curve->setPoint(i, normalizedKeyTimes[i], (keyValues + pointOffset), (Curve::InterpolationType) type);
         curve->setPoint(i, normalizedKeyTimes[i], (keyValues + pointOffset), (Curve::InterpolationType) type);
         pointOffset += propertyComponentCount;
         pointOffset += propertyComponentCount;
     }
     }
-    i = keyCount - 1;
-    normalizedKeyTimes[i] = 1.0f;
-    curve->setPoint(i, normalizedKeyTimes[i], keyValues + pointOffset, (Curve::InterpolationType) type);
+    if (keyCount > 1) {
+        i = keyCount - 1;
+        normalizedKeyTimes[i] = 1.0f;
+        curve->setPoint(i, normalizedKeyTimes[i], keyValues + pointOffset, (Curve::InterpolationType) type);
+    }
 
 
     SAFE_DELETE_ARRAY(normalizedKeyTimes);
     SAFE_DELETE_ARRAY(normalizedKeyTimes);