Merge "Correctly handle a null surface"

This commit is contained in:
TreeHugger Robot
2020-03-09 18:41:33 +00:00
committed by Android (Google) Code Review

View File

@@ -60,6 +60,9 @@ using ::android::sp;
static jobject convertSurfaceToNativeHandle(JNIEnv* env, jobject /* clazz */,
jobject previewSurface) {
if (previewSurface == nullptr) {
return nullptr;
}
ANativeWindow* previewAnw = ANativeWindow_fromSurface(env, previewSurface);
sp<Surface> surface = static_cast<Surface*>(previewAnw);
sp<IGraphicBufferProducer> igbp = surface->getIGraphicBufferProducer();