Handle mesh load failure without crashing

This commit is contained in:
sfan5 2021-03-12 19:30:56 +01:00
parent f213376b35
commit cff35cf0b3

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