fix: handle null maps when deactivating creature AI (#2629)
An uncontrolled creature with `Map == null` throws in `BaseAI.Deactivate()` when the condition reaches `Map.GetSector()`. A controlled creature with a null map avoids the exception but leaves its AI timer running. Treat a null map like `Map.Internal` in the existing stop condition. This stops the timer without dereferencing the missing map and leaves the existing valid-map condition and return-home scheduling unchanged. Addresses only the null-map `Deactivate()` item in #2627; the other audit items remain separate. No era-specific rules are changed.
This commit is contained in:
parent
51d2e998fc
commit
75f326bfdd
2 changed files with 34 additions and 1 deletions
|
|
@ -1102,7 +1102,7 @@ public abstract partial class BaseAI
|
|||
|
||||
public virtual void Deactivate()
|
||||
{
|
||||
if (Mobile.Map == Map.Internal || !Mobile.Controlled && !Mobile.Map.GetSector(Mobile.Location).Active)
|
||||
if (Mobile.Map == null || Mobile.Map == Map.Internal || !Mobile.Controlled && !Mobile.Map.GetSector(Mobile.Location).Active)
|
||||
{
|
||||
AITimer.Stop();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue