[textureview] validate TextureView surface texture when creating egl window surface (#278)

This commit is contained in:
Tobrun
2020-03-17 10:12:38 +01:00
committed by GitHub
parent 69b2d4c765
commit 14eb8f038a
2 changed files with 4 additions and 1 deletions

View File

@@ -1,9 +1,11 @@
package com.mapbox.mapboxsdk.maps.renderer.textureview;
import android.graphics.SurfaceTexture;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.UiThread;
import android.view.TextureView;
import com.mapbox.mapboxsdk.log.Logger;
@@ -390,7 +392,7 @@ class TextureViewRenderThread extends Thread implements TextureView.SurfaceTextu
// Create an EGL surface we can render into.
TextureView view = textureViewWeakRef.get();
if (view != null) {
if (view != null && view.getSurfaceTexture() != null) {
int[] surfaceAttribs = {EGL10.EGL_NONE};
eglSurface = egl.eglCreateWindowSurface(eglDisplay, eglConfig, view.getSurfaceTexture(), surfaceAttribs);
} else {