Skip to content

Commit 4c7dc4a

Browse files
author
Romain Guy
committed
Add extra error check when eglCreateContext fails
Bug #7216919 Change-Id: I322cbe4579d7a4eb2a64d288175e145d0badc857
1 parent 87e2f75 commit 4c7dc4a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

core/java/android/view/HardwareRenderer.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -864,6 +864,12 @@ void initializeEgl() {
864864

865865
if (mEglContext == null) {
866866
mEglContext = createContext(sEgl, sEglDisplay, sEglConfig);
867+
if (mEglContext == null) {
868+
//noinspection ConstantConditions
869+
throw new IllegalStateException("Could not create an EGL context. " +
870+
"eglCreateContext failed with error: " +
871+
GLUtils.getEGLErrorString(sEgl.eglGetError()));
872+
}
867873
sEglContextStorage.set(createManagedContext(mEglContext));
868874
}
869875
}

0 commit comments

Comments
 (0)