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: 2aa9eb497d ("nir: Add a helper for finding a function by name")
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29063>
This commit is contained in:
Karol Herbst 2024-05-06 14:05:14 +02:00 committed by Marge Bot
parent 13bd413860
commit 569c2fcf95
1 changed files with 1 additions and 1 deletions

View File

@ -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;
}