Skip to content

fix(ecs): Check if the component is not alive before destroying it - #443

Merged
ikkentim merged 1 commit into
ikkentim:masterfrom
DevD4v3:patch-2
Mar 1, 2025
Merged

ikkentim merged 1 commit into
ikkentim:masterfrom
DevD4v3:patch-2

Conversation

@DevD4v3

@DevD4v3 DevD4v3 commented Nov 2, 2024

Copy link
Copy Markdown
Contributor

Problem Context

When a player is kicked from the game upon clicking the accept button in the dialog, an exception is generated:

[SampSharp:ERROR] Unhandled exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> SampSharp.Entities.EntityNotFoundException: The specified entity could not be found. (Parameter 'component')
   at SampSharp.Entities.EntityManager.Destroy(Component component)
   at SampSharp.Entities.Component.Destroy()
   at SampSharp.Entities.SAMP.DialogSystem.OnDialogResponse(VisibleDialog player, Int32 dialogId, Int32 response, Int32 listItem, String inputText)
   at lambda_method4(Closure, Object, Object[], IServiceProvider, IEntityManager)
   at SampSharp.Entities.EventService.<>c__DisplayClass11_0.<CreateInvoker>b__0(Object instance, EventContext eventContext)
   at SampSharp.Entities.EventService.Invoke(EventContext context)
   at SampSharp.Entities.SAMP.EntityMiddleware.Invoke(EventContext context, IEntityManager entityManager)
   at lambda_method97(Closure, Object, EventContext, IServiceProvider)
   at SampSharp.Entities.EventService.<>c__DisplayClass12_0.<BuildInvoke>b__0(Object[] args)
   at InvokeStub_<>c__DisplayClass12_0.<BuildInvoke>b__0(Object, Span`1)
   at System.Reflection.MethodBaseInvoker.InvokeWithOneArg(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   --- End of inner exception stack trace ---
   at System.Reflection.MethodBaseInvoker.InvokeWithOneArg(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at SampSharp.Core.Callbacks.Callback.Invoke(Byte[] buffer, Int32 startIndex)
   at SampSharp.Core.HostedGameModeClient.PublicCall(String name, IntPtr data, Int32 length)

A specific example can be found here.

@ikkentim
ikkentim merged commit 6914c59 into ikkentim:master Mar 1, 2025
@ikkentim

ikkentim commented Mar 1, 2025

Copy link
Copy Markdown
Owner

Thanks!

@DevD4v3
DevD4v3 deleted the patch-2 branch June 13, 2026 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants