From b5bd6f8d20da365c48beec4d33f10ca430640f90 Mon Sep 17 00:00:00 2001 From: Mike Robinson Date: Tue, 7 Oct 2014 04:36:39 +0100 Subject: [PATCH] Fix segfault on invalid graphics context driver Last element of gfx_ctx_drivers[] is NULL, don't dereference it. --- gfx/gfx_context.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gfx/gfx_context.c b/gfx/gfx_context.c index bc0ff014a7..e2cc2d920f 100644 --- a/gfx/gfx_context.c +++ b/gfx/gfx_context.c @@ -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]; }