Skip to content

Commit

Permalink
Fix raster cache optional value check logic (flutter#42592)
Browse files Browse the repository at this point in the history
Possible fix for flutter/flutter#128308
  • Loading branch information
zanderso authored Jun 6, 2023
1 parent 8ba7bc8 commit 4e80c6f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion flow/layers/layer_raster_cache_item.cc
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ bool LayerRasterCacheItem::Draw(const PaintContext& context,
bool LayerRasterCacheItem::Draw(const PaintContext& context,
DlCanvas* canvas,
const DlPaint* paint) const {
if (!layer_children_id_.has_value() || !context.raster_cache || !canvas) {
if (!context.raster_cache || !canvas) {
return false;
}
switch (cache_state_) {
Expand All @@ -185,6 +185,9 @@ bool LayerRasterCacheItem::Draw(const PaintContext& context,
return context.raster_cache->Draw(key_id_, *canvas, paint);
}
case RasterCacheItem::kChildren: {
if (!layer_children_id_.has_value()) {
return false;
}
return context.raster_cache->Draw(layer_children_id_.value(), *canvas,
paint);
}
Expand Down

0 comments on commit 4e80c6f

Please sign in to comment.