From 8c22112a7d237a357fc9f373aaa413c8da8ccaab Mon Sep 17 00:00:00 2001 From: Eric Engestrom Date: Mon, 13 May 2024 11:21:35 +0200 Subject: [PATCH] util/format: add missing null check in util_format_is_srgb() Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/11137 Fixes: ff6cf60cb80c3bc31d9a ("gallium/util: add util_format_is_srgb() helper") Part-of: --- src/util/format/u_format.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/util/format/u_format.h b/src/util/format/u_format.h index adde3eb44e3..ccc2d6c0c96 100644 --- a/src/util/format/u_format.h +++ b/src/util/format/u_format.h @@ -554,6 +554,12 @@ static inline bool util_format_is_srgb(enum pipe_format format) { const struct util_format_description *desc = util_format_description(format); + + assert(desc); + if (!desc) { + return false; + } + return desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB; }