From 9047630ae783a482b0d102dac91a4cd3c49c960a Mon Sep 17 00:00:00 2001 From: Caleb Heydon Date: Sun, 1 Dec 2024 16:46:26 -0500 Subject: [PATCH] [rmodels] Fix null pointer dereference in LoadImageFromCgltfImage (#4557) --- src/rmodels.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rmodels.c b/src/rmodels.c index 05ad8083..28911ad6 100644 --- a/src/rmodels.c +++ b/src/rmodels.c @@ -5110,7 +5110,7 @@ static Image LoadImageFromCgltfImage(cgltf_image *cgltfImage, const char *texPat image = LoadImage(TextFormat("%s/%s", texPath, cgltfImage->uri)); } } - else if (cgltfImage->buffer_view->buffer->data != NULL) // Check if image is provided as data buffer + else if (cgltfImage->buffer_view != NULL && cgltfImage->buffer_view->buffer->data != NULL) // Check if image is provided as data buffer { unsigned char *data = RL_MALLOC(cgltfImage->buffer_view->size); int offset = (int)cgltfImage->buffer_view->offset;