fftools/ffplay: fix crash when vk renderer is null

When vulkan rendering is requested by the user and fails, ffplay should
exit graciously instead of crash due to a null pointer deref.

Signed-off-by: Leandro Santiago <leandrosansilva@gmail.com>
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
This commit is contained in:
Leandro Santiago 2024-10-31 21:50:45 +01:00 committed by Zhao Zhili
parent 7b20985d8d
commit fd0cacc472
1 changed files with 5 additions and 0 deletions

View File

@ -2612,6 +2612,11 @@ static int create_hwaccel(AVBufferRef **device_ctx)
if (type == AV_HWDEVICE_TYPE_NONE)
return AVERROR(ENOTSUP);
if (!vk_renderer) {
av_log(NULL, AV_LOG_ERROR, "Vulkan renderer is not available\n");
return AVERROR(ENOTSUP);
}
ret = vk_renderer_get_hw_dev(vk_renderer, &vk_dev);
if (ret < 0)
return ret;