From 569c2fcf952a3ec13ddf77c0058e769bf68f3aaf Mon Sep 17 00:00:00 2001 From: Karol Herbst Date: Mon, 6 May 2024 14:05:14 +0200 Subject: [PATCH] nir: fix nir_shader_get_function_for_name for functions without names. It's legal in SPIRV for functions to not have names, we have to take this into account when calling into strcmp here. Fixes: 2aa9eb497d0 ("nir: Add a helper for finding a function by name") Signed-off-by: Karol Herbst Part-of: --- src/compiler/nir/nir.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index f25f67428bd0b..29c5d78a9df87 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -4332,7 +4332,7 @@ static inline nir_function * nir_shader_get_function_for_name(const nir_shader *shader, const char *name) { nir_foreach_function(func, shader) { - if (strcmp(func->name, name) == 0) + if (func->name && strcmp(func->name, name) == 0) return func; }