CogEngine: Fix crash

This commit is contained in:
Arnaud Jamin
2025-02-06 01:50:57 -05:00
parent cee4787d9a
commit b2d1d312f8
2 changed files with 8 additions and 3 deletions
@@ -226,9 +226,10 @@ void ACogEngineReplicator::Server_DeleteActor_Implementation(AActor* Actor)
void ACogEngineReplicator::Server_ApplyCheat_Implementation(const AActor* CheatInstigator, const TArray<AActor*>& Targets, const FCogEngineCheat& Cheat) const void ACogEngineReplicator::Server_ApplyCheat_Implementation(const AActor* CheatInstigator, const TArray<AActor*>& Targets, const FCogEngineCheat& Cheat) const
{ {
if (Cheat.Execution == nullptr) if (Cheat.Execution == nullptr)
{ { return; }
return;
} if (GetWorld() == nullptr)
{ return; }
Cheat.Execution->Execute(GetWorld(), CheatInstigator, Targets); Cheat.Execution->Execute(GetWorld(), CheatInstigator, Targets);
} }
@@ -236,6 +237,9 @@ void ACogEngineReplicator::Server_ApplyCheat_Implementation(const AActor* CheatI
//-------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------
ECogEngineCheat_ActiveState ACogEngineReplicator::IsCheatActiveOnTargets(const TArray<AActor*>& Targets, const FCogEngineCheat& Cheat) const ECogEngineCheat_ActiveState ACogEngineReplicator::IsCheatActiveOnTargets(const TArray<AActor*>& Targets, const FCogEngineCheat& Cheat) const
{ {
if (GetWorld() == nullptr)
{ return ECogEngineCheat_ActiveState::Inactive; }
if (Cheat.Execution == nullptr) if (Cheat.Execution == nullptr)
{ {
return ECogEngineCheat_ActiveState::Inactive; return ECogEngineCheat_ActiveState::Inactive;
@@ -190,6 +190,7 @@ void FCogEngineWindow_Cheats::RenderContent()
if (Replicator == nullptr) if (Replicator == nullptr)
{ {
ImGui::TextDisabled("No Replicator"); ImGui::TextDisabled("No Replicator");
return;
} }
if (ImGui::BeginMenuBar()) if (ImGui::BeginMenuBar())