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
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 4474355..949a030 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -8295,10 +8295,12 @@
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) {