@@ -864,12 +864,6 @@ 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- }
873867 sEglContextStorage .set (createManagedContext (mEglContext ));
874868 }
875869 }
@@ -998,8 +992,15 @@ private void enableDirtyRegions() {
998992 EGLContext createContext (EGL10 egl , EGLDisplay eglDisplay , EGLConfig eglConfig ) {
999993 int [] attribs = { EGL_CONTEXT_CLIENT_VERSION , mGlVersion , EGL_NONE };
1000994
1001- return egl .eglCreateContext (eglDisplay , eglConfig , EGL_NO_CONTEXT ,
1002- mGlVersion != 0 ? attribs : null );
995+ EGLContext context = egl .eglCreateContext (eglDisplay , eglConfig , EGL_NO_CONTEXT ,
996+ mGlVersion != 0 ? attribs : null );
997+ if (context == null ) {
998+ //noinspection ConstantConditions
999+ throw new IllegalStateException (
1000+ "Could not create an EGL context. eglCreateContext failed with error: " +
1001+ GLUtils .getEGLErrorString (sEgl .eglGetError ()));
1002+ }
1003+ return context ;
10031004 }
10041005
10051006 @ Override
0 commit comments