Handle mesh load failure without crashing

master
sfan5 2021-03-12 19:30:56 +01:00
parent f213376b35
commit cff35cf0b3
1 changed files with 2 additions and 0 deletions

View File

@ -1921,6 +1921,8 @@ scene::IAnimatedMesh* Client::getMesh(const std::string &filename, bool cache)
scene::IAnimatedMesh *mesh = RenderingEngine::get_scene_manager()->getMesh(rfile);
rfile->drop();
if (!mesh)
return nullptr;
mesh->grab();
if (!cache)
RenderingEngine::get_mesh_cache()->removeMesh(mesh);