Fixed Skeleton_setAttachment("slotname", 0).

This commit is contained in:
NathanSweet 2013-06-24 16:24:50 +02:00
parent 7bfbf42494
commit 41cbe3bf3d

View File

@ -184,9 +184,13 @@ int Skeleton_setAttachment (Skeleton* self, const char* slotName, const char* at
for (i = 0; i < self->slotCount; ++i) { for (i = 0; i < self->slotCount; ++i) {
Slot *slot = self->slots[i]; Slot *slot = self->slots[i];
if (strcmp(slot->data->name, slotName) == 0) { if (strcmp(slot->data->name, slotName) == 0) {
Attachment* attachment = Skeleton_getAttachmentForSlotIndex(self, i, attachmentName); if (!attachmentName)
if (!attachment) return 0; Slot_setAttachment(slot, 0);
Slot_setAttachment(slot, attachment); else {
Attachment* attachment = Skeleton_getAttachmentForSlotIndex(self, i, attachmentName);
if (!attachment) return 0;
Slot_setAttachment(slot, attachment);
}
return 1; return 1;
} }
} }