fix: Fixes link list not crashing when broken. (#1877)
This commit is contained in:
parent
3cb688a2fb
commit
b4611ab7eb
4 changed files with 15 additions and 16 deletions
|
|
@ -212,6 +212,11 @@ public partial class Map
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!Unsafe.IsNullRef(in _linkList) && _linkList.Version != _currentVersion)
|
||||
{
|
||||
throw new InvalidOperationException(CollectionThrowStrings.InvalidOperation_EnumFailedVersion);
|
||||
}
|
||||
|
||||
Mobile m;
|
||||
NetState current = _current;
|
||||
ref Rectangle2D bounds = ref _bounds;
|
||||
|
|
@ -247,11 +252,6 @@ public partial class Map
|
|||
current = _linkList._first;
|
||||
}
|
||||
|
||||
if (_linkList.Version != _currentVersion)
|
||||
{
|
||||
throw new InvalidOperationException(CollectionThrowStrings.InvalidOperation_EnumFailedVersion);
|
||||
}
|
||||
|
||||
m = current.Mobile;
|
||||
if (m?.Deleted == false && bounds.Contains(m.Location))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -243,6 +243,11 @@ public partial class Map
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!Unsafe.IsNullRef(in _linkList) && _linkList.Version != _currentVersion)
|
||||
{
|
||||
throw new InvalidOperationException(CollectionThrowStrings.InvalidOperation_EnumFailedVersion);
|
||||
}
|
||||
|
||||
Item current = _current;
|
||||
ref Rectangle2D bounds = ref _bounds;
|
||||
var currentSectorX = _currentSectorX;
|
||||
|
|
@ -277,11 +282,6 @@ public partial class Map
|
|||
current = _linkList._first;
|
||||
}
|
||||
|
||||
if (_linkList.Version != _currentVersion)
|
||||
{
|
||||
throw new InvalidOperationException(CollectionThrowStrings.InvalidOperation_EnumFailedVersion);
|
||||
}
|
||||
|
||||
if (current is T { Deleted: false, Parent: null } o && bounds.Contains(o.Location))
|
||||
{
|
||||
_current = o;
|
||||
|
|
|
|||
|
|
@ -242,6 +242,11 @@ public partial class Map
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!Unsafe.IsNullRef(in _linkList) && _linkList.Version != _currentVersion)
|
||||
{
|
||||
throw new InvalidOperationException(CollectionThrowStrings.InvalidOperation_EnumFailedVersion);
|
||||
}
|
||||
|
||||
Mobile current = _current;
|
||||
ref Rectangle2D bounds = ref _bounds;
|
||||
var currentSectorX = _currentSectorX;
|
||||
|
|
@ -276,11 +281,6 @@ public partial class Map
|
|||
current = _linkList._first;
|
||||
}
|
||||
|
||||
if (_linkList.Version != _currentVersion)
|
||||
{
|
||||
throw new InvalidOperationException(CollectionThrowStrings.InvalidOperation_EnumFailedVersion);
|
||||
}
|
||||
|
||||
if (current is T { Deleted: false } o && bounds.Contains(o.Location))
|
||||
{
|
||||
_current = o;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue