correctly handle partically correct webp

This commit is contained in:
Green Sky
2025-10-09 16:16:25 +02:00
parent 8f1e872f1c
commit 9d7800bb4f

View File

@@ -70,7 +70,10 @@ ImageLoaderWebP::ImageResult ImageLoaderWebP::loadFromMemoryRGBA(const uint8_t*
while (WebPAnimDecoderHasMoreFrames(dec.get())) { while (WebPAnimDecoderHasMoreFrames(dec.get())) {
uint8_t* buf; uint8_t* buf;
int timestamp; int timestamp;
WebPAnimDecoderGetNext(dec.get(), &buf, &timestamp); if (WebPAnimDecoderGetNext(dec.get(), &buf, &timestamp) == 0 || buf == nullptr) {
// error out with empty res
return {};
}
// ... (Render 'buf' based on 'timestamp'). // ... (Render 'buf' based on 'timestamp').
// ... (Do NOT free 'buf', as it is owned by 'dec'). // ... (Do NOT free 'buf', as it is owned by 'dec').