Fix segfault with a null gl context.

This commit is contained in:
orbea 2019-01-19 12:12:43 -08:00
parent 5611977de0
commit 46676289d4
2 changed files with 7 additions and 0 deletions

View File

@ -1727,6 +1727,7 @@ static void *gl_init(const video_info_t *video,
char *error_string = NULL;
gl_t *gl = (gl_t*)calloc(1, sizeof(gl_t));
const gfx_ctx_driver_t *ctx_driver = gl_get_context(gl);
if (!gl || !ctx_driver)
goto error;
@ -1782,6 +1783,9 @@ static void *gl_init(const video_info_t *video,
RARCH_LOG("[GL]: Vendor: %s, Renderer: %s.\n", vendor, renderer);
RARCH_LOG("[GL]: Version: %s.\n", version);
if (string_is_equal(ctx_driver->ident, "null"))
goto error;
if (!string_is_empty(version))
sscanf(version, "%d.%d", &gl->version_major, &gl->version_minor);

View File

@ -38,5 +38,8 @@ void rglgen_resolve_symbols_custom(rglgen_proc_address_t proc,
void rglgen_resolve_symbols(rglgen_proc_address_t proc)
{
if (!proc)
return;
rglgen_resolve_symbols_custom(proc, rglgen_symbol_map);
}