Skip to content

Commit

Permalink
Merge pull request #60334 from twobitadder/mesh_array_graceful_fail
Browse files Browse the repository at this point in the history
`mesh_surface_get_format_offset` and `mesh_surface_get_format_stride` should now print an error message instead of silently crashing
  • Loading branch information
clayjohn authored Apr 19, 2022
2 parents 494876e + 8e57aae commit 3ba9803
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions servers/visual_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -848,13 +848,15 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_
}

uint32_t VisualServer::mesh_surface_get_format_offset(uint32_t p_format, int p_vertex_len, int p_index_len, int p_array_index) const {
ERR_FAIL_INDEX_V(p_array_index, ARRAY_MAX, 0);
uint32_t offsets[ARRAY_MAX];
uint32_t strides[ARRAY_MAX];
mesh_surface_make_offsets_from_format(p_format, p_vertex_len, p_index_len, offsets, strides);
return offsets[p_array_index];
}

uint32_t VisualServer::mesh_surface_get_format_stride(uint32_t p_format, int p_vertex_len, int p_index_len, int p_array_index) const {
ERR_FAIL_INDEX_V(p_array_index, ARRAY_MAX, 0);
uint32_t offsets[ARRAY_MAX];
uint32_t strides[ARRAY_MAX];
mesh_surface_make_offsets_from_format(p_format, p_vertex_len, p_index_len, offsets, strides);
Expand Down

0 comments on commit 3ba9803

Please sign in to comment.