]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
fix(SharedGunSystem): Return and debug log on CreateEffect. (#29656)
authorCaasGit <87243814+CaasGit@users.noreply.github.com>
Sat, 13 Jul 2024 06:12:57 +0000 (23:12 -0700)
committerGitHub <noreply@github.com>
Sat, 13 Jul 2024 06:12:57 +0000 (16:12 +1000)
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.

Content.Client/Weapons/Ranged/Systems/GunSystem.cs

index ac5914d47c0358b0d74132c87b6af3372992bbc4..71342277674b6cf0aa54c461f938ca1b311857af 100644 (file)
@@ -276,6 +276,14 @@ public sealed partial class GunSystem : SharedGunSystem
         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;