Эх сурвалжийг харах

[libgdx] Fixed crash when a pingpong sequence has 1 frame.

Nathan Sweet 3 жил өмнө
parent
commit
81baef0b5b

+ 2 - 2
spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Animation.java

@@ -2496,7 +2496,7 @@ public class Animation {
 					break;
 				case pingpong: {
 					int n = (count << 1) - 2;
-					index %= n;
+					index = n == 0 ? 0 : index % n;
 					if (index >= count) index = n - index;
 					break;
 				}
@@ -2508,7 +2508,7 @@ public class Animation {
 					break;
 				case pingpongReverse:
 					int n = (count << 1) - 2;
-					index = (index + count - 1) % n;
+					index = n == 0 ? 0 : (index + count - 1) % n;
 					if (index >= count) index = n - index;
 				}
 			}