From f5e94a2840ae2a03310cfab51d668f1ba9d9c45f Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Sat, 29 Dec 2018 21:27:20 +0100 Subject: [PATCH] Add a check for the resule of a dynamic cast. --- code/BlenderCustomData.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/code/BlenderCustomData.cpp b/code/BlenderCustomData.cpp index 682186618..6561eaf22 100644 --- a/code/BlenderCustomData.cpp +++ b/code/BlenderCustomData.cpp @@ -28,7 +28,11 @@ namespace Assimp { #define IMPL_STRUCT_READ(ty) \ bool read##ty(ElemBase *v, const size_t cnt, const FileDatabase &db) { \ - return read(db.dna[#ty], dynamic_cast(v), cnt, db); \ + ty *ptr = dynamic_cast(v); \ + if (nullptr == ptr) { \ + return false; \ + } \ + return read(db.dna[#ty], ptr, cnt, db); \ } #define IMPL_STRUCT_CREATE(ty) \