fixed #18, an animation start frame number is bigger than existing file frame count, now guarded .

This commit is contained in:
Zero Fanker 2024-05-31 16:01:27 -04:00
parent 422019253d
commit 654e68fdbc
2 changed files with 6 additions and 0 deletions

View file

@ -534,6 +534,9 @@ bool CLoading::LoadSingleFrameShape(const CString& name, int nFrame, int deltaX,
if (!FSunPackLib::XCC_GetSHPHeader(&header)) {
return false;
}
if (nFrame >= header.c_images) {
nFrame = 0;
}
if (!FSunPackLib::LoadSHPImage(nFrame, 1, &pBuffer)) {
return false;
}

View file

@ -922,6 +922,9 @@ namespace FSunPackLib
if (head.cx == 0 || head.cy == 0) {
return FALSE;
}
if (startIndex >= head.c_images) {
return FALSE;
}
std::vector<byte> decode_image_buffer;
for (auto frameIdx = 0; frameIdx < wantedNum; frameIdx++) {