mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-04-22 06:02:04 +02:00
fix infinite loop when gif total frames != decoded frames
This commit is contained in:
parent
393449e376
commit
6fa276f551
1 changed files with 7 additions and 2 deletions
|
@ -522,7 +522,12 @@ Bitmap::Bitmap(const char *filename)
|
||||||
// Loop gif (Either it's looping or it's not, at the moment)
|
// Loop gif (Either it's looping or it's not, at the moment)
|
||||||
p->animation.loop = handler.gif->loop_count >= 0;
|
p->animation.loop = handler.gif->loop_count >= 0;
|
||||||
|
|
||||||
while (handler.gif->decoded_frame < handler.gif->frame_count - 1) {
|
int fcount = handler.gif->frame_count;
|
||||||
|
int fcount_partial = handler.gif->frame_count_partial;
|
||||||
|
if (fcount > fcount_partial) {
|
||||||
|
Debug() << "Non-fatal error reading" << filename << ": Only decoded" << fcount_partial << "out of" << fcount << "frames";
|
||||||
|
}
|
||||||
|
while (handler.gif->decoded_frame < fcount_partial - 1) {
|
||||||
TEXFBO texfbo;
|
TEXFBO texfbo;
|
||||||
try {
|
try {
|
||||||
texfbo = shState->texPool().request(p->animation.width, p->animation.height);
|
texfbo = shState->texPool().request(p->animation.width, p->animation.height);
|
||||||
|
@ -553,7 +558,7 @@ Bitmap::Bitmap(const char *filename)
|
||||||
delete handler.gif_data;
|
delete handler.gif_data;
|
||||||
|
|
||||||
throw Exception(Exception::MKXPError, "Failed to decode frame GIF frame %i out of %i (Error %i)",
|
throw Exception(Exception::MKXPError, "Failed to decode frame GIF frame %i out of %i (Error %i)",
|
||||||
handler.gif->decoded_frame + 1, handler.gif->frame_count, status);
|
handler.gif->decoded_frame + 1, fcount_partial, status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue