Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit e2f4197

Browse files
committed
Do not abort if a MultiFrameCodec is unable to allocate a bitmap buffer
Fixes flutter/flutter#113014
1 parent 3634b6b commit e2f4197

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/ui/painting/multi_frame_codec.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,11 @@ sk_sp<DlImage> MultiFrameCodec::State::GetNextFrameImage(
9393
SkImageInfo updated = info.makeAlphaType(kPremul_SkAlphaType);
9494
info = updated;
9595
}
96-
bitmap.allocPixels(info);
96+
if (!bitmap.tryAllocPixels(info)) {
97+
FML_LOG(ERROR) << "Failed to allocate memory for bitmap of size "
98+
<< info.computeMinByteSize() << "B";
99+
return nullptr;
100+
}
97101

98102
ImageGenerator::FrameInfo frameInfo =
99103
generator_->GetFrameInfo(nextFrameIndex_);

0 commit comments

Comments
 (0)