Skip to content

Commit 75b99ee

Browse files
committed
Fix creating ConvexShape from ModelData;
1 parent 2665266 commit 75b99ee

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/modules/data/modelData.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ void lovrModelDataGetTriangles(ModelData* model, float** vertices, uint32_t** in
271271
ModelMetadata* meta = &model->meta;
272272

273273
*vertexCount = 0;
274-
*indexCount = 0;
274+
if (indexCount) *indexCount = 0;
275275

276276
for (uint32_t i = 0; i < meta->nodeCount; i++) {
277277
if (meta->nodes[i].mesh != ~0u) {
@@ -280,7 +280,7 @@ void lovrModelDataGetTriangles(ModelData* model, float** vertices, uint32_t** in
280280

281281
for (uint32_t j = 0; j < mesh->partCount; j++) {
282282
if (mesh->parts[j].mode == DRAW_TRIANGLE_LIST) {
283-
*indexCount += mesh->parts[j].count;
283+
if (indexCount) *indexCount += mesh->parts[j].count;
284284
}
285285
}
286286
}

0 commit comments

Comments
 (0)