Skip to content

Commit

Permalink
Check if a portal is known when it is being destroyed. Addresses #36
Browse files Browse the repository at this point in the history
  • Loading branch information
SpikeHimself committed Mar 31, 2023
1 parent 0bc0570 commit 79e16a1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions XPortal/XPortal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,11 @@ internal static void OnPortalPlaced(ZDOID portalId, Vector3 location)
/// <param name="portalId">The ZDOID of the portal being destroyed</param>
internal static void OnPortalDestroyed(ZDOID portalId)
{
if (!KnownPortalsManager.Instance.ContainsId(portalId))
{
Log.Error($"Portal `{portalId}` is being destroyed, but XPortal does not know it");
return;
}
var portalName = KnownPortalsManager.Instance.GetKnownPortalById(portalId).Name;
Log.Debug($"Portal `{portalName}` is being destroyed");
SendToServer.RemoveRequest(portalId);
Expand Down

0 comments on commit 79e16a1

Please sign in to comment.