Fix a segfault if OpenGL was not initialized before calling
write_header().

Signed-off-by: Nicolas George <geo...@nsup.org>
---
 libavdevice/opengl_enc.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavdevice/opengl_enc.c b/libavdevice/opengl_enc.c
index fa94345a7c..3d60f7d068 100644
--- a/libavdevice/opengl_enc.c
+++ b/libavdevice/opengl_enc.c
@@ -588,6 +588,10 @@ static av_cold int opengl_read_limits(AVFormatContext *h)
 
     version = glGetString(GL_VERSION);
     extensions = glGetString(GL_EXTENSIONS);
+    if (!version || !extensions) {
+        av_log(h, AV_LOG_ERROR, "OpenGL not available\n");
+        return AVERROR(ENOSYS);
+    }
 
     av_log(h, AV_LOG_DEBUG, "OpenGL version: %s\n", version);
     sscanf(version, "%d.%d", &major, &minor);
-- 
2.25.0

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to