Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fixes searching null map crash #1975

Merged
merged 1 commit into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions Projects/Server/Maps/Map.ClientEnumerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,14 @@ public MobileEnumerator(Map map, Rectangle2D bounds, bool makeBoundsInclusive)

_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)]
Expand Down
11 changes: 7 additions & 4 deletions Projects/Server/Maps/Map.ItemEnumerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -226,11 +226,14 @@ public ItemEnumerator(Map map, Rectangle2D bounds, bool makeBoundsInclusive)

_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)]
Expand Down
11 changes: 7 additions & 4 deletions Projects/Server/Maps/Map.MobileEnumerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,14 @@ public MobileEnumerator(Map map, Rectangle2D bounds, bool makeBoundsInclusive)

_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)]
Expand Down
13 changes: 8 additions & 5 deletions Projects/Server/Maps/Map.MultiEnumerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,15 @@ public MultiBoundsEnumerator(Map map, Rectangle2D bounds, bool makeBoundsInclusi

_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;
_index = 0;
// We start the X sector one short because it gets incremented immediately in MoveNext()
_currentSectorX = _sectorStartX - 1;
_currentSectorY = _sectorStartY;
_index = 0;
}
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
Expand Down
Loading