From 661401f4a5f0a57ff74dd9cc6c23536268e4548f Mon Sep 17 00:00:00 2001 From: xufulong <839789740@qq.com> Date: Tue, 18 Aug 2020 00:28:16 +0800 Subject: [PATCH] check nativeWindow is null or not check nativeWindow is null or not --- app/src/main/cpp/video_filter.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/src/main/cpp/video_filter.c b/app/src/main/cpp/video_filter.c index b1f2971..dbf762c 100644 --- a/app/src/main/cpp/video_filter.c +++ b/app/src/main/cpp/video_filter.c @@ -187,6 +187,10 @@ int open_input(JNIEnv *env, const char *file_name, jobject surface) { } nativeWindow = ANativeWindow_fromSurface(env, surface); + if (!nativeWindow) { + LOGE(TAG, "nativeWindow is null..."); + return -1; + } ANativeWindow_setBuffersGeometry(nativeWindow, pCodecCtx->width, pCodecCtx->height, WINDOW_FORMAT_RGBA_8888); pFrame = av_frame_alloc();