Fix issue when removing drawable from scene by setting it's scene to nullptr

This commit is contained in:
Georg Hagen
2024-07-16 15:35:06 +02:00
parent 9feece4df3
commit 013127bab0

View File

@@ -133,10 +133,13 @@ namespace OpenVulkano::Scene
}
for (auto& drawable : drawables)
{
Scene* drawableScene = drawable->GetScene();
if(drawableScene && drawableScene != scene) [[unlikely]]
if (scene)
{
throw std::runtime_error("Drawable is already associated with a scene! Creating copy.");
Scene* drawableScene = drawable->GetScene();
if(drawableScene && drawableScene != scene) [[unlikely]]
{
throw std::runtime_error("Drawable is already associated with a scene! Creating copy.");
}
}
drawable->SetScene(scene);
}