]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix null ref exception in PrayerSystem (#28712)
authorTayrtahn <tayrtahn@gmail.com>
Sat, 8 Jun 2024 18:50:20 +0000 (14:50 -0400)
committerGitHub <noreply@github.com>
Sat, 8 Jun 2024 18:50:20 +0000 (14:50 -0400)
* Fix null ref exception in PrayerSystem

* Also check that prayable ent/comp still exist

Content.Server/Prayer/PrayerSystem.cs

index 3b1ec3fa0838fe8795d33f4b3c5590c431c8f436..59fd9a5d6931b688298d3c1050f001b43a999941 100644 (file)
@@ -56,7 +56,9 @@ public sealed class PrayerSystem : EntitySystem
 
                 _quickDialog.OpenDialog(actor.PlayerSession, Loc.GetString(comp.Verb), Loc.GetString("prayer-popup-notify-pray-ui-message"), (string message) =>
                 {
-                    Pray(actor.PlayerSession, comp, message);
+                    // Make sure the player's entity and the Prayable entity+component still exist
+                    if (actor?.PlayerSession != null && HasComp<PrayableComponent>(uid))
+                        Pray(actor.PlayerSession, comp, message);
                 });
             },
             Impact = LogImpact.Low,