correctly handle partically correct webp
This commit is contained in:
@@ -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, ×tamp);
|
if (WebPAnimDecoderGetNext(dec.get(), &buf, ×tamp) == 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').
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user