Skip to content

Commit efaf1e9

Browse files
committed
fix(ecs): Check if the component is not alive before destroying it
1 parent c09a54e commit efaf1e9

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/SampSharp.Entities/SAMP/Dialogs/DialogSystem.cs

+5-2
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,13 @@ private void OnDialogResponse(VisibleDialog player, int dialogId, int response,
3535
return; // Prevent dialog hacks
3636

3737
player.ResponseReceived = true;
38-
player.Handler(new DialogResult(response == 1
39-
? DialogResponse.LeftButton
38+
player.Handler(new DialogResult(response == 1
39+
? DialogResponse.LeftButton
4040
: DialogResponse.RightButtonOrCancel, listItem, inputText));
4141

42+
if (!player.IsComponentAlive)
43+
return;
44+
4245
player.Destroy();
4346
}
4447
}

0 commit comments

Comments
 (0)