Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions Source/platform/graphics/BitmapImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,12 @@ bool BitmapImage::ensureFrameIsCached(size_t index)
if (index >= frameCount())
return false;

if (index >= m_frames.size() || !m_frames[index].m_frame)
cacheFrame(index);
if (index >= m_frames.size() || !m_frames[index].m_frame) {
cacheFrame(index);
if (index >= m_frames.size() || !m_frames[index].m_frame) {
return false;
}
}
return true;
}

Expand Down Expand Up @@ -368,8 +372,10 @@ PassRefPtr<NativeImageSkia> BitmapImage::nativeImageForCurrentFrame()

PassRefPtr<Image> BitmapImage::imageForDefaultFrame()
{
if (isBitmapImage() && maybeAnimated())
return BitmapImage::create(frameAtIndex(0));
if (isBitmapImage() && maybeAnimated()) {
RefPtr<NativeImageSkia> fr = frameAtIndex(0);
if (fr) return BitmapImage::create(fr);
}

return Image::imageForDefaultFrame();
}
Expand Down