The problem is not that I'm trying to pass null to this function. The problem is that the runtime does it.
If the user calls spAnimationState_setAnimationByName or spAnimationState_addAnimationByName with a non existent animation name the runtime fails:
Your code does not check if animation is valid:
spTrackEntry* spAnimationState_setAnimationByName (spAnimationState* self, int trackIndex, const char* animationName,
int/[i]bool[/i]/loop) {
spAnimation* animation = spSkeletonData_findAnimation(self->data->skeletonData, animationName);
return spAnimationState_setAnimation(self, trackIndex, animation, loop);
}
spTrackEntry* spAnimationState_addAnimationByName (spAnimationState* self, int trackIndex, const char* animationName,
int/[i]bool[/i]/loop, float delay) {
spAnimation* animation = spSkeletonData_findAnimation(self->data->skeletonData, animationName);
return spAnimationState_addAnimation(self, trackIndex, animation, loop, delay);
}