roflmuffin / CounterStrikeSharp

CounterStrikeSharp allows you to write server plugins in C# for Counter-Strike 2/Source2/CS2
https://docs.cssharp.dev
Other
743 stars 111 forks source link

map change crash #383

Closed brkvlr closed 5 months ago

brkvlr commented 5 months ago

20:24:03 [EROR] (cssharp:Core) Error invoking callback System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.  ---> System.ArgumentNullException: Schema target points to null. (Parameter 'pointer')  at CounterStrikeSharp.API.Core.CBasePlayerController.get_SteamID() in /home/runner/work/CounterStrikeSharp/CounterStrikeSharp/managed/CounterStrikeSharp.API/Core/Schema/Classes/CBasePlayerController.g.cs:line 123  at Advertisement.Ads.b__101(EventPlayerDisconnect event, GameEventInfo )  at InvokeStub_GameEventHandler`1.Invoke(Object, Object, IntPtr)  at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr args, BindingFlags invokeAttr)  --- End of inner exception stack trace ---  at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr args, BindingFlags invokeAttr)  at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)  at System.Delegate.DynamicInvokeImpl(Object[] args)  at CounterStrikeSharp.API.Core.FunctionReference.b__18_0(fxScriptContext context) in /home/runner/work/CounterStrikeSharp/CounterStrikeSharp/managed/CounterStrikeSharp.API/Core/FunctionReference.cs:line 120

B3none commented 5 months ago

�[39;49m�[37m ---> System.ArgumentNullException: Schema target points to null. (Parameter 'pointer')�[39;49m �[39;49m�[37m at CounterStrikeSharp.API.Core.CBasePlayerController.get_SteamID() in /home/runner/work/CounterStrikeSharp/CounterStrikeSharp/managed/CounterStrikeSharp.API/Core/Schema/Classes/CBasePlayerController.g.cs:line 123�[39;49m

Make sure you're checking to ensure that player is valid / not null before you try calling getSteamID()

B3none commented 5 months ago

Closing as this is a plugin issue, and not one with CounterStrikeSharp.