fix: Fixes searching null map crash (#1975)

This commit is contained in:
Kamron Batman 2024-10-15 17:52:27 -07:00 committed by GitHub
parent 9f985b0c38
commit 3fc55e4db3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 29 additions and 17 deletions

View file

@ -195,11 +195,14 @@ public partial class Map
_bounds = bounds;
map.CalculateSectors(bounds, out _sectorStartX, out var _sectorStartY, out _sectorEndX, out _sectorEndY);
if (map != null)
{
map.CalculateSectors(bounds, out _sectorStartX, out var _sectorStartY, out _sectorEndX, out _sectorEndY);
// We start the X sector one short because it gets incremented immediately in MoveNext()
_currentSectorX = _sectorStartX - 1;
_currentSectorY = _sectorStartY;
// We start the X sector one short because it gets incremented immediately in MoveNext()
_currentSectorX = _sectorStartX - 1;
_currentSectorY = _sectorStartY;
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]