1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-05-09 18:43:48 +00:00

fix crash when saving skel after bones were removed

This commit is contained in:
fgenesis 2022-10-12 18:59:25 +02:00
parent 0469ab8dfb
commit 288fb6b7fa

View file

@ -1146,15 +1146,18 @@ bool SkeletalSprite::saveSkeletal(const std::string &fn)
{ {
BoneKeyframe *b = &a->keyframes[j].keyframes[k]; BoneKeyframe *b = &a->keyframes[j].keyframes[k];
Bone *bone = this->getBoneByIdx(b->idx); Bone *bone = this->getBoneByIdx(b->idx);
os << b->idx << " " << b->x << " " << b->y << " " << b->rot << " "; if(bone)
// don't want to store grid points if they can be regenerated automatically {
size_t usedGridSize = bone->gridType == Quad::GRID_INTERP ? 0 : b->grid.size(); os << b->idx << " " << b->x << " " << b->y << " " << b->rot << " ";
os << usedGridSize << " "; // don't want to store grid points if they can be regenerated automatically
if(usedGridSize) size_t usedGridSize = bone->gridType == Quad::GRID_INTERP ? 0 : b->grid.size();
for (size_t i = 0; i < usedGridSize; i++) os << usedGridSize << " ";
os << b->grid[i].x << " " << b->grid[i].y << " "; if(usedGridSize)
if (b->doScale) for (size_t i = 0; i < usedGridSize; i++)
szos << b->idx << " " << b->sx << " " << b->sy << " "; os << b->grid[i].x << " " << b->grid[i].y << " ";
if (b->doScale)
szos << b->idx << " " << b->sx << " " << b->sy << " ";
}
} }
std::string szoss = szos.str(); std::string szoss = szos.str();
if (!szoss.empty()) if (!szoss.empty())