Skip to content

Commit

Permalink
fix(SharedGunSystem): Return and debug log on CreateEffect. (space-wi…
Browse files Browse the repository at this point in the history
…zards#29656)

Sometimes CreateEffect is called on a Invalid Entity. This now causes
that to check, thus returning out and printing some hopefully helpful
logs to try to track down the real source of this issue.
  • Loading branch information
CaasGit authored and aspiringLich committed Jul 21, 2024
1 parent aa3cbc6 commit 7dfa363
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Content.Client/Weapons/Ranged/Systems/GunSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,14 @@ protected override void CreateEffect(EntityUid gunUid, MuzzleFlashEvent message,
if (!Timing.IsFirstTimePredicted)
return;

// EntityUid check added to stop throwing exceptions due to https://github.com/space-wizards/space-station-14/issues/28252
// TODO: Check to see why invalid entities are firing effects.
if (gunUid == EntityUid.Invalid)
{
Log.Debug($"Invalid Entity sent MuzzleFlashEvent (proto: {message.Prototype}, user: {user})");
return;
}

var gunXform = Transform(gunUid);
var gridUid = gunXform.GridUid;
EntityCoordinates coordinates;
Expand Down

0 comments on commit 7dfa363

Please sign in to comment.