From 4c7dc4aa5c6c155d7756ad40befc931fc0719976 Mon Sep 17 00:00:00 2001 From: Romain Guy <romainguy@google.com> Date: Mon, 24 Sep 2012 15:35:33 -0700 Subject: Add extra error check when eglCreateContext fails Bug #7216919 Change-Id: I322cbe4579d7a4eb2a64d288175e145d0badc857 --- core/java/android/view/HardwareRenderer.java | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'core/java') diff --git a/core/java/android/view/HardwareRenderer.java b/core/java/android/view/HardwareRenderer.java index bafab21..49f9e9d 100644 --- a/core/java/android/view/HardwareRenderer.java +++ b/core/java/android/view/HardwareRenderer.java @@ -864,6 +864,12 @@ public abstract class HardwareRenderer { if (mEglContext == null) { mEglContext = createContext(sEgl, sEglDisplay, sEglConfig); + if (mEglContext == null) { + //noinspection ConstantConditions + throw new IllegalStateException("Could not create an EGL context. " + + "eglCreateContext failed with error: " + + GLUtils.getEGLErrorString(sEgl.eglGetError())); + } sEglContextStorage.set(createManagedContext(mEglContext)); } } -- cgit v1.1