diff options
author | Jesse Hall <jessehall@google.com> | 2016-09-28 11:26:57 -0700 |
---|---|---|
committer | gitbuildkicker <android-build@google.com> | 2016-09-28 16:23:48 -0700 |
commit | d393137574fc5d529a4186160af08da29ac64abd (patch) | |
tree | 1a1b22c76ae8b2eb9d12143a8e1a1e49b1500e58 | |
parent | 88b30e5e407f0cf7027ee660afb35cf721b018a6 (diff) | |
download | native-d393137574fc5d529a4186160af08da29ac64abd.tar.gz |
EGL: check that display is still valid
Bug: 31522731
Change-Id: I84d82e55aba5b58dfdbcac9e208c36767fbedfd1
(cherry picked from commit d6e9946cdd57a92c9bc86ba97a4ca42078153008)
-rw-r--r-- | opengl/libs/EGL/egl_display.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/opengl/libs/EGL/egl_display.cpp b/opengl/libs/EGL/egl_display.cpp index e335a6cc31..1e39aae40d 100644 --- a/opengl/libs/EGL/egl_display.cpp +++ b/opengl/libs/EGL/egl_display.cpp @@ -66,7 +66,10 @@ egl_display_t::~egl_display_t() { egl_display_t* egl_display_t::get(EGLDisplay dpy) { uintptr_t index = uintptr_t(dpy)-1U; - return (index >= NUM_DISPLAYS) ? NULL : &sDisplay[index]; + if (index >= NUM_DISPLAYS || !sDisplay[index].isValid()) { + return nullptr; + } + return &sDisplay[index]; } void egl_display_t::addObject(egl_object_t* object) { |