Explorar o código

Check default skin, fixed crash.

NathanSweet %!s(int64=9) %!d(string=hai) anos
pai
achega
ae4ac8210f

+ 9 - 6
spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Skeleton.java

@@ -197,13 +197,11 @@ public class Skeleton {
 			Slot slot = constraint.target;
 			int slotIndex = slot.getData().index;
 			Bone slotBone = slot.bone;
-			if (skin != null) {
-				for (Entry<Key, Attachment> entry : skin.attachments.entries())
-					if (entry.key.slotIndex == slotIndex) sortPathConstraintAttachment(entry.value, slotBone);
-			}
+			if (skin != null) sortPathConstraintAttachment(skin, slotIndex, slotBone);
+			if (data.defaultSkin != null && data.defaultSkin != skin)
+				sortPathConstraintAttachment(data.defaultSkin, slotIndex, slotBone);
 			for (int ii = 0, nn = data.skins.size; ii < nn; ii++)
-				for (Entry<Key, Attachment> entry : data.skins.get(i).attachments.entries())
-					if (entry.key.slotIndex == slotIndex) sortPathConstraintAttachment(entry.value, slotBone);
+				sortPathConstraintAttachment(data.skins.get(ii), slotIndex, slotBone);
 
 			Attachment attachment = slot.getAttachment();
 			if (attachment instanceof PathAttachment) sortPathConstraintAttachment(attachment, slotBone);
@@ -244,6 +242,11 @@ public class Skeleton {
 			sortBone(bones.get(i));
 	}
 
+	private void sortPathConstraintAttachment (Skin skin, int slotIndex, Bone slotBone) {
+		for (Entry<Key, Attachment> entry : skin.attachments.entries())
+			if (entry.key.slotIndex == slotIndex) sortPathConstraintAttachment(entry.value, slotBone);
+	}
+
 	private void sortPathConstraintAttachment (Attachment attachment, Bone slotBone) {
 		if (!(attachment instanceof PathAttachment)) return;
 		int[] pathBones = ((PathAttachment)attachment).getBones();