diff options
| author | 2024-03-29 18:16:57 +0000 | |
|---|---|---|
| committer | 2024-03-29 18:24:08 +0000 | |
| commit | d96534c47ef132f2da600cd565ed2e3cc12ff7ad (patch) | |
| tree | 73c30e6a36e1c73b8072856810741c063c129704 | |
| parent | 06bf5557c902dd6a1bb88acbd3b5fd8ec48e1278 (diff) | |
Add snapshot nullptr check in SF#renderScreenImpl
A layer that is not parented to the layer hierarchy could
have a null snapshot, in which case we can ignore it when
finding the display.
Fixes: b/331874495, b/331923495
Test: presubmit
Change-Id: I06ed68d2af4afd47fb83f8c38ba11b70fe6700f0
| -rw-r--r-- | services/surfaceflinger/SurfaceFlinger.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 447435549b..949a030c1f 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -8295,10 +8295,12 @@ ftl::SharedFuture<FenceResult> SurfaceFlinger::renderScreenImpl( const frontend::LayerSnapshot* snapshot = mLayerLifecycleManagerEnabled ? mLayerSnapshotBuilder.getSnapshot(parent->sequence) : parent->getLayerSnapshot(); - display = findDisplay([layerStack = - snapshot->outputFilter.layerStack](const auto& display) { - return display.getLayerStack() == layerStack; - }).get(); + if (snapshot) { + display = findDisplay([layerStack = snapshot->outputFilter.layerStack]( + const auto& display) { + return display.getLayerStack() == layerStack; + }).get(); + } } if (display == nullptr) { |