Fix a segfault if OpenGL was not initialized before calling write_header().
Unified · Split
| @@ -588,6 +588,10 @@ static av_cold int opengl_read_limits(AVFormatContext *h) · 587 unmodified lines | ||
| 588 | 588 | |
| 589 | 589 | version = glGetString(GL_VERSION); |
| 590 | 590 | extensions = glGetString(GL_EXTENSIONS); |
| 591 | + if (!version || !extensions) { | |
| 592 | + av_log(h, AV_LOG_ERROR, "No OpenGL context initialized for the current thread\n"); | |
| 593 | + return AVERROR(ENOSYS); | |
| 594 | + } | |
| 591 | 595 | |
| 592 | 596 | av_log(h, AV_LOG_DEBUG, "OpenGL version: %s\n", version); |
| 593 | 597 | sscanf(version, "%d.%d", &major, &minor); |