From 42e0f56c6c33bc5aa27b4a7faba4bc0c9b5f898d Mon Sep 17 00:00:00 2001 From: tovjemam Date: Fri, 20 Feb 2026 21:29:46 +0100 Subject: [PATCH] Fix segfault --- src/game/entity.cpp | 4 +++- src/gameview/entityview.cpp | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/game/entity.cpp b/src/game/entity.cpp index 618d5be..f464ff2 100644 --- a/src/game/entity.cpp +++ b/src/game/entity.cpp @@ -21,7 +21,9 @@ void game::Entity::Update() if (parentnum_) { parent_ = world_.GetEntity(parentnum_); - parent_->TryUpdate(); + + if (parent_) + parent_->TryUpdate(); } // update transform parent diff --git a/src/gameview/entityview.cpp b/src/gameview/entityview.cpp index 1af7fc0..ca03531 100644 --- a/src/gameview/entityview.cpp +++ b/src/gameview/entityview.cpp @@ -47,7 +47,9 @@ void game::view::EntityView::Update(const UpdateInfo& info) if (parentnum_) { parent_ = world_.GetEntity(parentnum_); - parent_->TryUpdate(info); + + if (parent_) + parent_->TryUpdate(info); } // update transform parent