diff options
| author | 2020-10-08 18:40:47 +0000 | |
|---|---|---|
| committer | 2020-10-08 18:40:52 +0000 | |
| commit | 162f643dded48b230888139d1e4c8a5e2013a7cd (patch) | |
| tree | 2df985d7da5c32e2fd69054e289430ee3804ffd9 /services/surfaceflinger/SurfaceFlinger.cpp | |
| parent | c33d16d445eb1c1994f382408083060c2b39a5aa (diff) | |
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
Diffstat (limited to 'services/surfaceflinger/SurfaceFlinger.cpp')
| -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)))) { |