Fix segfault on invalid graphics context driver

Last element of gfx_ctx_drivers[] is NULL, don't dereference it.
This commit is contained in:
Mike Robinson 2014-10-07 04:36:39 +01:00
parent 665a56b0b4
commit b5bd6f8d20

View File

@ -77,7 +77,7 @@ const gfx_ctx_driver_t *gfx_ctx_find_driver(const char *ident)
unsigned i;
for (i = 0; i < ARRAY_SIZE(gfx_ctx_drivers); i++)
{
if (strcmp(gfx_ctx_drivers[i]->ident, ident) == 0)
if (gfx_ctx_drivers[i] && strcmp(gfx_ctx_drivers[i]->ident, ident) == 0)
return gfx_ctx_drivers[i];
}