Skip to content

fix(events): fix null report targets after SCP:SL 14.2.9 update - #873

Open
Niruri wants to merge 1 commit into
ExMod-Team:devfrom
Niruri:fix-reporting-player-resolution
Open

Niruri wants to merge 1 commit into
ExMod-Team:devfrom
Niruri:fix-reporting-player-resolution

Conversation

@Niruri

@Niruri Niruri commented Nov 13, 2026

Copy link
Copy Markdown

Description

Describe the changes

Resolve the target of Server.LocalReporting and Server.ReportingCheater from playerNetId using ldarg.1 and Player.Get(uint), replacing the hard-coded ldloc.2 and Player.Get(ReferenceHub).

What is the current behavior?

In SCP:SL 14.2.9 server build, the target ReferenceHub is in local slot 1, but both report hooks still load slot 2, resulting in a null Target

[ERROR] [Exiled.Events] Method "<handler>" of the class "<plugin class>" caused an exception when handling the event "Exiled.Events.Features.Event`1[[Exiled.Events.EventArgs.Server.LocalReportingEventArgs, Exiled.Events, Version=9.15.2.0, Culture=neutral, PublicKeyToken=null]]"
System.NullReferenceException: Object reference not set to an instance of an object
  at <plugin class>.<handler> (Exiled.Events.EventArgs.Server.LocalReportingEventArgs ev) [0x00039]
  at Exiled.Events.Features.Event`1[T].BlendedInvoke (T arg) [0x00088]

What is the new behavior?

Player.Get(uint) uses the same ReferenceHub.TryGetHubNetID lookup as the original method, which has already validated playerNetId before either event runs. Both events resolve the intended player without depending on compiler-assigned local slots.

The local event remains inside the notifyGm == false branch; the global event remains after successful signature validation. The existing IsAllowed cancellation logic is unchanged.

Does this PR introduce a breaking change?

No.

Other information

Nothing.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentations

Submission checklist

  • I have checked the project can be compiled
  • I have tested my changes and it worked as expected (offline emitted-IL checks described above)

Patches (if there are any changes related to Harmony patches)

  • I have checked no IL patching errors in the console

Other

  • Still requires more testing (live Unity/Mono server verification)

@Niruri

Niruri commented Nov 13, 2026

Copy link
Copy Markdown
Author

Could we use LabAPI’s ReportingPlayer and ReportingCheater events here, like the existing reload adapters, to avoid relying on local variable slots?
If that's ok, I can do a rework for this pr.

@Niruri
Niruri force-pushed the fix-reporting-player-resolution branch from 5804ee9 to c4f78b5 Compare November 13, 2026 08:03
@Niruri
Niruri marked this pull request as ready for review November 13, 2026 08:36
@Someone-193

Copy link
Copy Markdown
Collaborator

Could we use LabAPI’s ReportingPlayer and ReportingCheater events here, like the existing reload adapters, to avoid relying on local variable slots? If that's ok, I can do a rework for this pr.

Considering this is targeting dev, go ahead! Only condition: Our event must maintain the same functionality. If the LabAPI equivalent has some missing functionality, we can't port it. Also, leave a comment on the event regarding the status of the port (see #875)

@Niruri

Niruri commented Nov 23, 2026

Copy link
Copy Markdown
Author

Could we use LabAPI’s ReportingPlayer and ReportingCheater events here, like the existing reload adapters, to avoid relying on local variable slots? If that's ok, I can do a rework for this pr.

Considering this is targeting dev, go ahead! Only condition: Our event must maintain the same functionality. If the LabAPI equivalent has some missing functionality, we can't port it. Also, leave a comment on the event regarding the status of the port (see #875)

yeah, that will be a big work for sl 15.x update. I will leave a comment for that when I got this pr finished :)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants