DebugSystem: Fix crash when asked to show collision mesh but entity has no collidercomponent

This commit is contained in:
Lynix 2018-04-21 00:27:46 +02:00
parent 7f9eb3771f
commit 9f74b71bd6
1 changed files with 5 additions and 2 deletions

View File

@ -181,9 +181,12 @@ namespace Ndk
const Nz::Boxf& obb = entityGfx.GetBoundingVolume().obb.localBox;
Nz::InstancedRenderableRef renderable = GenerateCollision3DMesh(entity);
renderable->SetPersistent(false);
if (renderable)
{
renderable->SetPersistent(false);
entityGfx.Attach(renderable, Nz::Matrix4f::Translate(obb.GetCenter()), DebugDrawOrder);
entityGfx.Attach(renderable, Nz::Matrix4f::Translate(obb.GetCenter()), DebugDrawOrder);
}
entityDebug.UpdateDebugRenderable(option, std::move(renderable));
break;