diff --git a/cogl/driver/gl/cogl-texture-driver-gl.c b/cogl/driver/gl/cogl-texture-driver-gl.c index 6cb004844..3c2296e69 100644 --- a/cogl/driver/gl/cogl-texture-driver-gl.c +++ b/cogl/driver/gl/cogl-texture-driver-gl.c @@ -400,7 +400,7 @@ _cogl_texture_driver_pixel_format_to_gl (CoglPixelFormat format, { CoglPixelFormat required_format; GLenum glintformat; - GLenum glformat; + GLenum glformat = 0; GLenum gltype; required_format = format; @@ -522,6 +522,10 @@ _cogl_texture_driver_pixel_format_to_gl (CoglPixelFormat format, break; } + /* All of the pixel formats are handled above so if this hits then + we've been given an invalid pixel format */ + g_assert (glformat != 0); + if (out_glintformat != NULL) *out_glintformat = glintformat; if (out_glformat != NULL) diff --git a/cogl/driver/gles/cogl-texture-driver-gles.c b/cogl/driver/gles/cogl-texture-driver-gles.c index 3c83a4558..817ee93f9 100644 --- a/cogl/driver/gles/cogl-texture-driver-gles.c +++ b/cogl/driver/gles/cogl-texture-driver-gles.c @@ -412,7 +412,7 @@ _cogl_texture_driver_pixel_format_to_gl (CoglPixelFormat format, { CoglPixelFormat required_format; GLenum glintformat; - GLenum glformat; + GLenum glformat = 0; GLenum gltype; required_format = format; @@ -491,6 +491,10 @@ _cogl_texture_driver_pixel_format_to_gl (CoglPixelFormat format, break; } + /* All of the pixel formats are handled above so if this hits then + we've been given an invalid pixel format */ + g_assert (glformat != 0); + if (out_glintformat != NULL) *out_glintformat = glintformat; if (out_glformat != NULL)