Fix use of nullptr field to calculate array size

Is probably harmless in practice, but the ASAN was generating an
error about it:

  draw_manager_data.cc:187:59: runtime error: member access within null pointer of type 'struct DRWUniformChunk'

Pull Request: https://projects.blender.org/blender/blender/pulls/108798
This commit is contained in:
Sergey Sharybin 2023-06-09 12:34:53 +02:00 committed by Sergey Sharybin
parent 0044c93e84
commit e682133d2d
1 changed files with 1 additions and 1 deletions

View File

@ -184,7 +184,7 @@ static void drw_shgroup_uniform_create_ex(DRWShadingGroup *shgroup,
/* Happens on first uniform or if chunk is full. */
if (!unichunk || unichunk->uniform_used == unichunk->uniform_len) {
unichunk = static_cast<DRWUniformChunk *>(BLI_memblock_alloc(DST.vmempool->uniforms));
unichunk->uniform_len = ARRAY_SIZE(shgroup->uniforms->uniforms);
unichunk->uniform_len = BOUNDED_ARRAY_TYPE_SIZE<decltype(shgroup->uniforms->uniforms)>();
unichunk->uniform_used = 0;
BLI_LINKS_PREPEND(shgroup->uniforms, unichunk);
}