Fix crash when model or skinned model loading fails

This commit is contained in:
Wojciech Figat
2021-11-24 17:42:01 +01:00
parent 7d970de5ce
commit af305dc376
4 changed files with 4 additions and 8 deletions

View File

@@ -125,8 +125,6 @@ Model::Model(const SpawnParams& params, const AssetInfo* info)
Model::~Model() Model::~Model()
{ {
// Ensure to be fully disposed
ASSERT(IsInitialized() == false);
ASSERT(_streamingTask == nullptr); ASSERT(_streamingTask == nullptr);
} }

View File

@@ -118,8 +118,6 @@ SkinnedModel::SkinnedModel(const SpawnParams& params, const AssetInfo* info)
SkinnedModel::~SkinnedModel() SkinnedModel::~SkinnedModel()
{ {
// Ensure to be fully disposed
ASSERT(IsInitialized() == false);
ASSERT(_streamingTask == nullptr); ASSERT(_streamingTask == nullptr);
} }

View File

@@ -24,8 +24,8 @@ DECLARE_SCRIPTING_TYPE_WITH_CONSTRUCTOR_IMPL(Mesh, MeshBase);
protected: protected:
bool _hasLightmapUVs; bool _hasLightmapUVs;
GPUBuffer* _vertexBuffers[3]; GPUBuffer* _vertexBuffers[3] = {};
GPUBuffer* _indexBuffer; GPUBuffer* _indexBuffer = nullptr;
#if USE_PRECISE_MESH_INTERSECTS #if USE_PRECISE_MESH_INTERSECTS
CollisionProxy _collisionProxy; CollisionProxy _collisionProxy;
#endif #endif

View File

@@ -19,8 +19,8 @@ API_CLASS(NoSpawn) class FLAXENGINE_API SkinnedMesh : public MeshBase
DECLARE_SCRIPTING_TYPE_WITH_CONSTRUCTOR_IMPL(SkinnedMesh, MeshBase); DECLARE_SCRIPTING_TYPE_WITH_CONSTRUCTOR_IMPL(SkinnedMesh, MeshBase);
protected: protected:
GPUBuffer* _vertexBuffer; GPUBuffer* _vertexBuffer = nullptr;
GPUBuffer* _indexBuffer; GPUBuffer* _indexBuffer = nullptr;
mutable Array<byte> _cachedIndexBuffer; mutable Array<byte> _cachedIndexBuffer;
mutable Array<byte> _cachedVertexBuffer; mutable Array<byte> _cachedVertexBuffer;
mutable int32 _cachedIndexBufferCount; mutable int32 _cachedIndexBufferCount;