layers: Gitlab 41 & 61, Fix invalid descriptor dereferences in helper codegen

Descriptor type arrays should only be dereferenced depending on the specified
descriptorType parameter. Caused crashes in api_dump.
1 file changed