diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp index 1a50abc31d0..9a16a28d393 100644 --- a/src/mesa/main/shader_query.cpp +++ b/src/mesa/main/shader_query.cpp @@ -581,8 +581,11 @@ _mesa_program_resource_find_name(struct gl_shader_program *shProg, { struct gl_program_resource *res = NULL; + if (name == NULL) + return NULL; + /* If we have a name, try the ProgramResourceHash first. */ - if (name && shProg->data->ProgramResourceHash) + if (shProg->data->ProgramResourceHash) res = search_resource_hash(shProg, programInterface, name, array_index); if (res)