diff --git a/src/image_loader_webp.cpp b/src/image_loader_webp.cpp index 77af085..bd6fdde 100644 --- a/src/image_loader_webp.cpp +++ b/src/image_loader_webp.cpp @@ -70,7 +70,10 @@ ImageLoaderWebP::ImageResult ImageLoaderWebP::loadFromMemoryRGBA(const uint8_t* while (WebPAnimDecoderHasMoreFrames(dec.get())) { uint8_t* buf; int timestamp; - WebPAnimDecoderGetNext(dec.get(), &buf, ×tamp); + if (WebPAnimDecoderGetNext(dec.get(), &buf, ×tamp) == 0 || buf == nullptr) { + // error out with empty res + return {}; + } // ... (Render 'buf' based on 'timestamp'). // ... (Do NOT free 'buf', as it is owned by 'dec').