GabiRP / CoinTweaks

An EXILED plugin that adds more features (currently 2) for Coins (SCPSL 11.0)
0 stars 0 forks source link

NRE #2

Open KrisPrs opened 2 years ago

KrisPrs commented 2 years ago

I think, this error occurs, when player has flipped the coin and rapidly dropped it before the plugin does

NullReferenceException: Object reference not set to an instance of an object Exiled.API.Features.Player.DropItem (Exiled.API.Features.Items.Item item) (at <0c29492668bf43e18175c196a750b4be>:0) CoinTweaks.EventHandlers+<>c__DisplayClass2_0.<OnFlippingCoin>b__0 () (at <6ea95509d13a4628a134f6b06adec182>:0) MEC.Timing+<_DelayedCall>d__310.MoveNext () (at <58e6c1ac7a4d44a4999c56139fd40fdf>:0) MEC.Timing.Update () (at <58e6c1ac7a4d44a4999c56139fd40fdf>:0) UnityEngine.Debug:LogException(Exception) MEC.Timing:Update()

GabiRP commented 2 years ago

Can't reproduce, are you sure you're getting that error when throwing the coin before the plugin does?

KrisPrs commented 2 years ago

No, i've got this error via error handler. The only line, where this error can occur is this: https://github.com/GabiRP/CoinTweaks/blob/0c3e97392806af5f5327e9fd9e32d1b3b4cb3e64/CoinTweaks/EventHandlers.cs#L19 I have many others plugins, but it's not possible to confilct with yours (none of them uses OnFlippingCoin event)

GabiRP commented 2 years ago

I know that's the line, but I can't reproduce the issue

KrisPrs commented 2 years ago

This error have happed to me 15 times, but i can't say, why is it happening. image You may be sure, my players flip the coin often

KrisPrs commented 2 years ago

It may be many reasons ev.Player.CurrentItem to be null. Couldn't you just add a nullcheck to be sure?

GabiRP commented 2 years ago

Alright, use this and tell me if it still happens.

Using Mega because I can't link a dll file here

KrisPrs commented 2 years ago

Okay, ty

KrisPrs commented 2 years ago

Well, that error no longer happends, but i got a new one: image Afaik, this error happeds, when you try to show hint to disconnected player. Yeah, there are many possible errors, when you use multiply Timing.CallDelayeds

GabiRP commented 2 years ago

i don't think it's because there are multiple CallDelayed s, as if the first executes, the second doesn't and viceversa. Anyway, I'll look into this.