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,12 +195,15 @@ public partial class Map
|
||||||
|
|
||||||
_bounds = bounds;
|
_bounds = bounds;
|
||||||
|
|
||||||
|
if (map != null)
|
||||||
|
{
|
||||||
map.CalculateSectors(bounds, out _sectorStartX, out var _sectorStartY, out _sectorEndX, out _sectorEndY);
|
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)]
|
||||||
public bool MoveNext()
|
public bool MoveNext()
|
||||||
|
|
|
||||||
|
|
@ -226,12 +226,15 @@ public partial class Map
|
||||||
|
|
||||||
_bounds = bounds;
|
_bounds = bounds;
|
||||||
|
|
||||||
|
if (map != null)
|
||||||
|
{
|
||||||
map.CalculateSectors(bounds, out _sectorStartX, out var _sectorStartY, out _sectorEndX, out _sectorEndY);
|
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)]
|
||||||
public bool MoveNext()
|
public bool MoveNext()
|
||||||
|
|
|
||||||
|
|
@ -225,12 +225,15 @@ public partial class Map
|
||||||
|
|
||||||
_bounds = bounds;
|
_bounds = bounds;
|
||||||
|
|
||||||
|
if (map != null)
|
||||||
|
{
|
||||||
map.CalculateSectors(bounds, out _sectorStartX, out var _sectorStartY, out _sectorEndX, out _sectorEndY);
|
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)]
|
||||||
public bool MoveNext()
|
public bool MoveNext()
|
||||||
|
|
|
||||||
|
|
@ -189,6 +189,8 @@ public partial class Map
|
||||||
|
|
||||||
_bounds = bounds;
|
_bounds = bounds;
|
||||||
|
|
||||||
|
if (map != null)
|
||||||
|
{
|
||||||
map.CalculateSectors(bounds, out _sectorStartX, out var _sectorStartY, out _sectorEndX, out _sectorEndY);
|
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()
|
||||||
|
|
@ -196,6 +198,7 @@ public partial class Map
|
||||||
_currentSectorY = _sectorStartY;
|
_currentSectorY = _sectorStartY;
|
||||||
_index = 0;
|
_index = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
private bool GetMulti()
|
private bool GetMulti()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue