diff options
author | Ady Abraham <adyabr@google.com> | 2020-10-08 18:40:47 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2020-11-12 18:34:31 +0000 |
commit | 688e72b4fa6197879183c83d9349bcbf08b5053b (patch) | |
tree | 0fabfae5646a515ec03e6d8d18cd658f25ed2890 | |
parent | 2ab3009f7a2d6403b4cda5b30504ee4a10fea1b0 (diff) | |
download | native-688e72b4fa6197879183c83d9349bcbf08b5053b.tar.gz |
SurfaceFlinger: check for nullptr on setFrameRate
Make sure that the layer still exists before trying to set
the frame rate for it.
Bug: 170027345
Change-Id: Ice1edd7c5320f4d1d915643e30430919de258dbc
Test: manual
(cherry picked from commit 162f643dded48b230888139d1e4c8a5e2013a7cd)
-rw-r--r-- | services/surfaceflinger/SurfaceFlinger.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 148749e6f0..c9e595abd1 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -6227,6 +6227,11 @@ status_t SurfaceFlinger::setFrameRate(const sp<IGraphicBufferProducer>& surface, Mutex::Autolock lock(mStateLock); if (authenticateSurfaceTextureLocked(surface)) { sp<Layer> layer = (static_cast<MonitoredProducer*>(surface.get()))->getLayer(); + if (layer == nullptr) { + ALOGE("Attempt to set frame rate on a layer that no longer exists"); + return BAD_VALUE; + } + if (layer->setFrameRate( Layer::FrameRate(frameRate, Layer::FrameRate::convertCompatibility(compatibility)))) { |