Add a check for the resule of a dynamic cast.

pull/2287/head
Kim Kulling 2018-12-29 21:27:20 +01:00
parent c1dc3901e7
commit f5e94a2840
1 changed files with 5 additions and 1 deletions

View File

@ -28,7 +28,11 @@ namespace Assimp {
#define IMPL_STRUCT_READ(ty) \ #define IMPL_STRUCT_READ(ty) \
bool read##ty(ElemBase *v, const size_t cnt, const FileDatabase &db) { \ bool read##ty(ElemBase *v, const size_t cnt, const FileDatabase &db) { \
return read<ty>(db.dna[#ty], dynamic_cast<ty *>(v), cnt, db); \ ty *ptr = dynamic_cast<ty*>(v); \
if (nullptr == ptr) { \
return false; \
} \
return read<ty>(db.dna[#ty], ptr, cnt, db); \
} }
#define IMPL_STRUCT_CREATE(ty) \ #define IMPL_STRUCT_CREATE(ty) \