Skip to content

Bug: framework/gui.h/update_buffers() crashes when "explicit_update == false" because vertex_buffer/index_buffer are null #1508

@Caiby

Description

@Caiby

When explicit_update is false , the update_buffers() function (line 1412) can still be called. vertex_buffer and index_buffer are initially null because persistent buffers are not created. However, the current code directly accesses vertex_buffer->get_handle() and vertex_buffer->get_size() without checking if the pointers are valid, causing a null pointer dereference.
Proposed Fix
Add null pointer checks before accessing vertex_buffer and index_buffer:

if (!vertex_buffer || !vertex_buffer->get_handle() || (vertex_buffer_size != vertex_buffer->get_size()))
{
    // Create buffer if needed
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions