Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MrDave1999
Copy link
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.

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.

2 participants