fix: Fixes searching null map crash (#1975)
This commit is contained in:
parent
9f985b0c38
commit
3fc55e4db3
4 changed files with 29 additions and 17 deletions
|
|
@ -195,11 +195,14 @@ public partial class Map
|
||||||
|
|
||||||
_bounds = bounds;
|
_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()
|
// We start the X sector one short because it gets incremented immediately in MoveNext()
|
||||||
_currentSectorX = _sectorStartX - 1;
|
_currentSectorX = _sectorStartX - 1;
|
||||||
_currentSectorY = _sectorStartY;
|
_currentSectorY = _sectorStartY;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
|
|
||||||
|
|
@ -226,11 +226,14 @@ public partial class Map
|
||||||
|
|
||||||
_bounds = bounds;
|
_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()
|
// We start the X sector one short because it gets incremented immediately in MoveNext()
|
||||||
_currentSectorX = _sectorStartX - 1;
|
_currentSectorX = _sectorStartX - 1;
|
||||||
_currentSectorY = _sectorStartY;
|
_currentSectorY = _sectorStartY;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
|
|
||||||
|
|
@ -225,11 +225,14 @@ public partial class Map
|
||||||
|
|
||||||
_bounds = bounds;
|
_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()
|
// We start the X sector one short because it gets incremented immediately in MoveNext()
|
||||||
_currentSectorX = _sectorStartX - 1;
|
_currentSectorX = _sectorStartX - 1;
|
||||||
_currentSectorY = _sectorStartY;
|
_currentSectorY = _sectorStartY;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
|
|
||||||
|
|
@ -189,12 +189,15 @@ public partial class Map
|
||||||
|
|
||||||
_bounds = bounds;
|
_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()
|
// We start the X sector one short because it gets incremented immediately in MoveNext()
|
||||||
_currentSectorX = _sectorStartX - 1;
|
_currentSectorX = _sectorStartX - 1;
|
||||||
_currentSectorY = _sectorStartY;
|
_currentSectorY = _sectorStartY;
|
||||||
_index = 0;
|
_index = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue