From 30466aaf161a8a594fe70d660c9f5f8604fdc433 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Fri, 24 May 2024 15:36:30 +0200 Subject: [PATCH] Fix possible nullptr dereferencing. (#5595) --- code/Common/Subdivision.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/code/Common/Subdivision.cpp b/code/Common/Subdivision.cpp index fc8ab20991..78c249807d 100644 --- a/code/Common/Subdivision.cpp +++ b/code/Common/Subdivision.cpp @@ -524,7 +524,11 @@ void CatmullClarkSubdivider::InternSubdivide( } } - ai_assert(adj[o] - moffsets[nidx].first < mp->mNumFaces); + if (mp == nullptr) { + continue; + } + + ai_assert(adj[o] - moffsets[nidx].first < mp->mNumFaces); const aiFace &f = mp->mFaces[adj[o] - moffsets[nidx].first]; bool haveit = false;