summaryrefslogtreecommitdiffstats
path: root/opengl
diff options
context:
space:
mode:
authorNaomi Luis <nluis@codeaurora.org>2010-04-22 18:04:31 -0700
committerSteve Kondik <shade@chemlab.org>2010-08-16 17:19:55 -0400
commitac058e627a35238aa86ca2bc39cead02097d3578 (patch)
treeedc4aeda22f97f404a35f96366ebad4fca1c3c1b /opengl
parent7715656790e7b9a4ae03ef8ec94706703861f180 (diff)
downloadframeworks_base-ac058e627a35238aa86ca2bc39cead02097d3578.zip
frameworks_base-ac058e627a35238aa86ca2bc39cead02097d3578.tar.gz
frameworks_base-ac058e627a35238aa86ca2bc39cead02097d3578.tar.bz2
frameworks/base/opengl: Add NULL check
Check for the validity of the attrs_list in eglChooseConfig before using it. This avoids a crash during tests in which the attributes are NULL. Change-Id: I1c0a46b505ae919e2454cfdce32f8dfc21ead247
Diffstat (limited to 'opengl')
-rw-r--r--opengl/libs/EGL/egl.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/opengl/libs/EGL/egl.cpp b/opengl/libs/EGL/egl.cpp
index 40317e7..de740a3 100644
--- a/opengl/libs/EGL/egl.cpp
+++ b/opengl/libs/EGL/egl.cpp
@@ -843,10 +843,13 @@ EGLBoolean eglChooseConfig( EGLDisplay dpy, const EGLint *attrib_list,
EGLint patch_index = -1;
GLint attr;
size_t size = 0;
- while ((attr=attrib_list[size]) != EGL_NONE) {
- if (attr == EGL_CONFIG_ID)
- patch_index = size;
- size += 2;
+
+ if (attrib_list != NULL) {
+ while ((attr=attrib_list[size]) != EGL_NONE) {
+ if (attr == EGL_CONFIG_ID)
+ patch_index = size;
+ size += 2;
+ }
}
if (patch_index >= 0) {
size += 2; // we need copy the sentinel as well